Skip to content

Instantly share code, notes, and snippets.

@arielvalentin
Last active January 3, 2023 18:05
Show Gist options
  • Save arielvalentin/81e2afebc7a1b5456d30df657ad86478 to your computer and use it in GitHub Desktop.
Save arielvalentin/81e2afebc7a1b5456d30df657ad86478 to your computer and use it in GitHub Desktop.
context = Context.current
Fiber.new {
Context.with_context(context) do
# your fiber code
OpenTelemetry::Trace.current_span.finish
end
}
Thread ->
main fiber local [->__opentelemetry_context_storage__] = [Root Context]
tracer.in_span("POST /graphql") => local [->__opentelemetry_context_storage__] = [Root Context][ Context[current_span] = "POST /graphql" ] {
graphql Dataloader
fiber_locals = [->__opentelemetry_context_storage__] = [Parent Context][Root Context][ Context[current_span] = "POST /graphql"
Fiber.new {
fiber_locals = [->__opentelemetry_context_storage__] = [Parent Context][Root Context][ Context[current_span] = "POST /graphql"
OpenTelemetry::Trace.current_span = ?? << Context[current_span] = Span<"POST /graphql">
tracer.in_span("operation a") {
fiber_locals = [->__opentelemetry_context_storage__] = [Parent Context][Root Context][ Context[current_span] = "POST /graphql"] [Context [current_span] = "operation a" ]
}
fiber_locals = [->__opentelemetry_context_storage__] = [Parent Context][Root Context][ Context[current_span] = "POST /graphql"
}
}
https://github.com/rmosolgo/graphql-ruby/blob/6803897ae8e07b08c9936596478e895e92a3125a/lib/graphql/dataloader.rb#L288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment