Skip to content

Tracing with Otel not reporting spans as expected. #921

Open
@rodolfoBee

Description

@rodolfoBee

Issue Description

With the code below, when I do a curl to the /posts URL. I expect a trace to be started, with a span for the GET /posts as the root (result in Sentry below).

But I would also expect this to have a child span that is mount-disconnected, which I can't find. I would also expect to find a child span for the DB query that is being done in Blog.list_posts(). I don't get that either.

When I do it in the browser, and actually get a websocket connection, I can find the mount-connected span. However, this have the same oddity as the non-connected case, where I don't get any child span for the find blog posts DB query.

The same tests were done exporting the opentelemetry spans to jaeger, where the user sees the expected result (info below).

Sentry stats do not show dropped spans.

Reproduction Steps

Repro app: https://github.com/allaboard-dev/oteltest

Otel span creation:

def mount(_params, _session, socket) do
span_name =
if connected?(socket) do
"mount-connected"
else
"mount-disconnected"
end

OpenTelemetry.Tracer.with_span span_name, %{the_name: span_name} do
{:ok, stream(socket, :posts, Blog.list_posts())}
end
end

Expected Behavior

The same configuration was used to send traces to jaeger, with the result:
Curl:
Image
Browser:
Image

Actual Behavior

The traces sent to Sentry:
Curl:
Image
Browser:
Image

Link to internal ticket with link to traces in Sentry

Elixir Version

1.14

SDK Version

11.0.1

Integration and Its Version

No response

Sentry Config

config :sentry,
dsn: System.get_env("SENTRY_DSN"),
environment_name: System.get_env("ENV_NAME"),
enable_source_code_context: true,
root_source_code_path: File.cwd!(),
tags: %{
env: System.get_env("ENV_NAME")
},
release: System.get_env("HEROKU_SLUG_COMMIT"),
traces_sample_rate: 1.0,
log_level: :debug

config :opentelemetry, span_processor: {Sentry.OpenTelemetry.SpanProcessor, []}
config :opentelemetry, sampler: {Sentry.OpenTelemetry.Sampler, []}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions