sentry-elixir icon indicating copy to clipboard operation
sentry-elixir copied to clipboard

Support for Traces/Transactions via Opentelemetry

Open solnic opened this issue 1 year ago • 0 comments

⚠️ this is currently built on top of #797 - I'll rebase once it's merged


This adds support for Traces via Opentelemetry integration, handled by our custom Sentry.Opentelemetry.SpanProcessor which accumulates spans and turns them into hierarchical transactions that are then sent to Sentry.

For this to work the following deps must be added to an app:

{:opentelemetry, "~> 1.4"},
{:opentelemetry_api, "~> 1.3"}

Furthermore, Opentelemetry needs to be configured with our SpanProcessor:

config :opentelemetry, span_processor: {Sentry.Opentelemetry.SpanProcessor, []}

The rest will automagically work.

Supported opentelemetry packages

This initial implementation supports the following Opentelemetry packages:

  • opentelemetry_phoenix
  • opentelemetry_bandit
  • opentelemetry_ecto

Considerations

  • Should we add new deps as sentry deps instead of having people add them manually to their mix.exs?
  • Would it make sense to try to pre-configure opentelemetry automatically?
  • Which other opentelemetry_* packages do we want to support initially?
  • Should we support top-level ecto events that occur when ie Ecto tries to create migrations table, or checks migrations? (I think we should ignore them, FWIW)

Screenshots

Screenshot 2024-09-24 at 17 54 07 Screenshot 2024-09-24 at 17 55 13 Screenshot 2024-09-24 at 19 12 50 Screenshot 2024-09-27 at 16 07 49 Screenshot 2024-09-27 at 16 07 21

solnic avatar Sep 04 '24 15:09 solnic