-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Multiple tracers in one schema are ignored #5044
Multiple tracers in one schema are ignored #5044
Comments
Hey, thanks for the detailed report and sorry for the trouble! Yes, these should definitely work well together. I think the problem is that these methods in the OpenTelementry trace module are missing I noticed that other methods there did include |
Nope, it's more complicated than that ... I've got a failing test over at #5045, I have to massage the inheritance code to make it work 😅 |
Well, maybe it's both. Looking at your example, I realized its different than the one I encountered in the OpenTelementry test suite. My initial suggestion, adding
|
Thanks so much for the speedy response! I'll try to test that branch of open-telemetry to confirm it's working today :) |
I retested today with the newly released |
Do you pass |
We don't actually. Nice pickup. Let me find out how I can set that in our service (the configuration of OpenTelemetry is done via another gem by default). |
👋 did you find any clues about this? I'd love to get it working properly... |
Hey! Sorry, I thought I posted back. We experimented with setting the schemas via the I attempted some hacking to use |
Ok, thanks for the update. I tinkered with the original script above to try to get it to fail, but I couldn't... I also reopened #5045 in case that's the cause, and I pushed a fix for the issue spotted there. Could you try your app with that patch? |
Oops, that issue autoclosed this one. It might fix it -- if you get a chance to try out master now that it's been merged, let me know what you find. |
Sorry, a retest confirms the bug. Switching from I don't know if this helps at all, but here's a screenshot from a debug which shows both modules appear to be added: I'm missing a lot of context, but is the problem that both modules ( eg. |
Ahhh yes! I hadn't looked at the AS::N trace yet, but I guess that's the issue. It doesn't call # frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
gem "graphql", "2.3.10" # path: "./"
gem 'opentelemetry-api'
gem 'opentelemetry-common'
gem 'opentelemetry-instrumentation-graphql'
gem 'opentelemetry-sdk'
gem 'rails'
end
ENV['OTEL_TRACES_EXPORTER'] = 'console'
OpenTelemetry::SDK.configure do |c|
c.use('OpenTelemetry::Instrumentation::GraphQL')
end
module MultipleTracer
class Thing < GraphQL::Schema::Object
field :str, String
def str; "blah"; end
end
class Named < GraphQL::Schema::Union
possible_types Thing
def self.resolve_type(obj, ctx)
Thing
end
end
class Query < GraphQL::Schema::Object
include GraphQL::Types::Relay::HasNodeField
field :int, Integer, null: false
def int
1
end
field :thing, Thing
def thing; :thing; end
field :named, Named, resolver_method: :thing
end
class TestSchema < GraphQL::Schema
query(Query)
trace_with(GraphQL::Tracing::ActiveSupportNotificationsTrace)
end
end
ActiveSupport::Notifications.monotonic_subscribe("execute_query.graphql") do |name, start, finish, _message_id, data|
puts "#{name} handled"
puts "#{data.inspect}"
# raise "Horray, it worked"
end
query = "{ int thing { str } named { ... on Thing { str } } }"
MultipleTracer::TestSchema.execute(query) I'll work up a patch for it. |
If you get a chance to try master again, please let me know what you find 😅 Thanks again for your help tracking this down. |
That did it, thank you! Really appreciate the back and forth and patience to get this one solved :) |
Describe the bug
This bug almost appears to be a duplicate of #4542 but this time around it's with the ActiveSupport and OpenTelemetry tracers.
This schema, with the default
OpenTelemetry
setup, sees the OpenTelemetry tracer completely ignored as spans are not included in traces yet metrics are emitted.If I mix and match the old tracer API, I'm able to get both working:
Versions
graphql
: 2.3.10opentelemetry-instrumentation-graphql
: 0.28.2rails
: 7.1.3.4Steps to reproduce
The test case demonstrates the opposite to the above due to how our app is built, but I think it's still sufficient to show the bug.
The console will be messy, but if you search for
execute_query.graphql handled
it will be absent. If these lines are commented out, and the command is re-run, you'll see the ActiveSupport handled messages.$ ruby inline.rb execute_query.graphql handled {:query=>query ...}
Expected behavior
Both tracers should be able to emit information about the GraphQL operations. So with the above example there should be a wall of trace info, as well as the two littles lines added by the ActiveSupport subscriber.
Actual behavior
The span information is emitted, but nothing from the ActiveSupport subscriber.
The text was updated successfully, but these errors were encountered: