-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add tracing for incoming requests #101
Conversation
bd40382
to
3243a6b
Compare
3243a6b
to
cb751db
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. I assume we can migrate to OpenTelemetry in the future, when our libraries are ready.
Note that Kubernetes API calls made here are not traced because they are not made using the context with the span attached.
…s in prepare downscale webhook
1c9537a
to
40b463c
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.
Thanks!
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, nothing major just some stylistic stuff.
|
||
spanLogger.SetTag("object.name", ar.Request.Name) | ||
spanLogger.SetTag("object.resource", ar.Request.Resource.Resource) | ||
spanLogger.SetTag("object.namespace", ar.Request.Namespace) | ||
|
||
oldObj, oldGVK, err := codecs.UniversalDeserializer().Decode(ar.Request.OldObject.Raw, nil, nil) | ||
if err != nil { | ||
return allowErr(logger, "can't decode old object, allowing the change", err) | ||
} | ||
logger = log.With(logger, "request_gvk", oldGVK) |
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 appreciate trying to minimize changes but it seems weird to use both logger
and spanLogger
. Can we use just the spanLogger
and not keep logger
around in these methods?
Apologies @charleskorn, I merged too early. I reverted the commit and restored the branch so you could respond to the above in a reopened PR. |
No worries, I'll continue in #114. |
This PR adds support for tracing incoming HTTP requests for the two webhooks.
It produces traces like the following, with nested spans for each of the HTTP calls:
I've used OpenTracing here over OpenTelemetry in the interests of consistency with Mimir.
I don't love how invasive these changes were - the default OpenTracing instrumentation for
net/http
requires callingnethttp.TraceRequest()
for each outgoing HTTP call, but any other option would require either creating our own OpenTracing instrumentation fornet/http
, or using OpenTelemetry, which would break with the existing pattern of Mimir. I'm very open to other ideas or suggestions.I don't believe we can't add tracing for Kubernetes API calls made by the informers used in the reconciliation loop, as these run outside the context of a parent span, so I haven't added tracing to the reconciliation loop beyond a single span.