Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running multiple platform traces at once #4543

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Jul 5, 2023

Fixes #4542

@platform_authorized_key_cache = Hash.new { |h, k| h[k] = platform_authorized_key(k) }
@platform_resolve_type_key_cache = Hash.new { |h, k| h[k] = platform_resolve_type_key(k) }

@platform_key_cache = Hash.new { |h, mod| h[mod] = mod::KeyCache.new }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The basic gist of the problem is here: since all the modules are mixed into a single class, they share a single set of instance variables and method definitions. I addressed this problem in two ways:

  • Platform keys are now cached per-module, so each module can reference its own cached keys.
  • Platform keys aren't fetched from the trace object itself; instead, the platform trace module is mixed into a new class, used only for getting those keys. That new class is assigned to mod::KeyCache.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's jumping through a lot of hoops, but IIRC, OpenTelemetry uses PlatformTrace, and I'd like to not require any changes downstream -- I think this will be seamless 🤞

@rmosolgo rmosolgo merged commit 0b52bcf into master Jul 11, 2023
@rmosolgo rmosolgo deleted the fix-multiple-trace-platforms branch July 24, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using multiple monitoring tools in GraphQL::Schema stopped working
1 participant