-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add distributed tracing support #4745
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
base: main
Are you sure you want to change the base?
Conversation
178f982 to
22bfc0c
Compare
22bfc0c to
c1d9a3c
Compare
|
I'll implement the Prometheus notifier changes in a new draft PR based on prometheus/prometheus#16355 |
thompson-tomo
left a comment
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.
Some feedback on attribute naming based on Open telemetry exposure in semconv. Might be worthwhile to add an alerting.platform.name attribute to the spans which stores alert manager.
Is there interest in having these signals defined in the open telemetry signal registry (semantic conventions)?
dispatch/dispatch.go
Outdated
| trace.WithAttributes(attrs...), | ||
| // we'll use producer here since the alert is not processed | ||
| // synchronously | ||
| trace.WithSpanKind(trace.SpanKindProducer), |
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.
Producer doesn't seem right to me based on
Whether a span represents an outgoing call to a remote service (CLIENT and PRODUCER spans) or a processing of an incoming request initiated externally (SERVER and CONSUMER spans).
Whether a Span represents a request/response operation (CLIENT and SERVER spans) or a deferred execution (PRODUCER and CONSUMER spans).
Perhaps it is internal?
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.
This is inherited code from the other PR, still need to check all the details.
But doesn't it fall under producer/consumer category? (the last sentence in the paragraph you quoted).
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.
Yes it satisfies the second But it needs also to satisfy the first. If it doesn't satisfy either then it is internal.
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.
I changed the span kinds to some extent, I'll have to review all to be sure if everything is set correctly.
We also use propagation now.
| return json.Marshal(result) | ||
| } | ||
|
|
||
| // TODO: probably move these into prometheus/common since they're copied from |
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.
This is probably a good idea, what do you think @ArthurSens?
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.
I can prepare a PR for common later this week.
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.
I would not be against it :)
c1d9a3c to
7b93382
Compare
858e51b to
14b79bd
Compare
Add tracing support using otel: - api: extract trace and span IDs from request context and add to alerts - types: add trace and span IDs to alerts - dispatch: add distributed tracing support - notify: add distributed tracing support This change borrows part of the implementation from prometheus#3673 Fixes prometheus#3670 Signed-off-by: Dave Henderson <dhenderson@gmail.com> Signed-off-by: Siavash Safi <siavash@cloudflare.com>
14b79bd to
47747ad
Compare
| trace.WithAttributes(attribute.String("alerting.notify.integration.name", i.name)), | ||
| trace.WithAttributes(attribute.Int("alerting.alerts.count", len(alerts))), | ||
| trace.WithSpanKind(trace.SpanKindClient), |
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.
Is there an easy way to add additional integration details potential some from https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-client-span in particular server.*, note I assume this span represents the outbound call to a notification system hence the client span kind.
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.
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.
If we are going to also have a http span then perhaps this should be internal.
| attribute.String("alerting.alert.name", alert.Name()), | ||
| attribute.String("alerting.alert.fingerprint", alert.Fingerprint().String()), | ||
| ), | ||
| trace.WithSpanKind(trace.SpanKindConsumer), |
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.
check this one
| trace.WithSpanKind(trace.SpanKindConsumer), | |
| trace.WithSpanKind(trace.SpanKindInternal), |
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.
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.
Missed that one, are these outgoing calls as per the test mentioned in #4745 (comment)

Add tracing support using otel:
This change borrows part of the implementation from #3673
Fixes #3670
TODO list:
tracingpackage and make changes/improvements if necessarywebhooknotifier and a test webhook receiver which is supports distributed tracing