-
Notifications
You must be signed in to change notification settings - Fork 176
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
chore (sync service): inject OTEL attributes for inclusion in traces within core Electric stacks #2077
Conversation
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
97126b6
to
9e05bc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for this approach. I don't like how many changes it makes to normal code in order to do the tracing. Personally I think we should go for a more aspect oriented approach. But perhaps that can be a later PR.
Thanks Kevin! On alternative approaches — "baggage" is an otel idea for passing around key/value pairs that can added easily as attributes. If the lib we're using has support for that then it's a good option as well https://opentelemetry.io/docs/concepts/signals/baggage/ |
Seems to be supported: https://hexdocs.pm/opentelemetry_api/0.5.0/OpenTelemetry.Baggage.html |
So there are a couple of possibilities:
|
Baggage is a key-value mapping that exists alongside attributes, right @KyleAMathews? If we want to define a set of attributes that is used by every span, we can set resource attributes in the configuration. We're already doing that for
To support per-tenant attributes, I would go with the approach where they are stored as a persistent term during the startup of the tenant supervision tree and are then read inside |
Baggage is a generic way to pass around key/value pairs but you still have to explicitly add it to each attribute. So actually if we want a way to say "these key/values are added to every span automatically" then we'd want to do something ourselves anyways. |
Closing in favor of #2083 which seems to be a better approach. |
This PR modifies core Electric such that stacks and the serve shape plug can take OTEL attributes to include in every span. As such, we can for instance inject the
database_id
attribute without requiring core Electric to be tenant aware. I don't include a changeset as this isn't user-facing.