-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[app-configuration] Adding distributed tracing #5360
[app-configuration] Adding distributed tracing #5360
Conversation
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.
One thing you'll need to be able to do is add the TracingPolicy
from core-http
as part of your request pipeline. You can see how keyvaults does that here:
requestPolicyFactories = requestPolicyFactories.concat([ |
The reason you want this is that this policy will create a span specific to the HTTP request (we'll add more properties to it in the future) and forwards the span context by adding the traceparent/tracestate headers to the outgoing request.
sdk/appconfiguration/app-configuration/src/internal/tracingHelpers.ts
Outdated
Show resolved
Hide resolved
sdk/appconfiguration/app-configuration/src/internal/tracingHelpers.ts
Outdated
Show resolved
Hide resolved
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.
Generally looks good! 👍
Left a couple comments.
I had debated about making a helper like this (where the traced code happens inside a callback.)
I think why I shied away from it is I remember having to debug similar code in F12 where it was really annoying if you stepped into the tracing code since you had to step through goop just to get back to your function body. So you ended up having to set a breakpoint in the inner function body and continue, whereas if you do the start/end pattern the developer can simply stepOver the two helper calls.
Something to think about 😄
sdk/appconfiguration/app-configuration/src/internal/tracingHelpers.ts
Outdated
Show resolved
Hide resolved
I'm with you on the steppability-issue with it. I'm more worried about consistently applying the pattern. Perhaps this is something we can do some work on with the code generator at some point so these classes will be a bit cleaner. |
eeb9db0
to
7d38e10
Compare
Added. Check out appConfigurationClient.ts's constructor. |
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.
Looks good!
c3a1000
to
6691c5d
Compare
6691c5d
to
56e729b
Compare
Some changes, mostly just refactoring.
One thing I discovered as I was doing this was that (not sure why) the listConfigurationSettingsOptions and listRevisionsOptions weren't exposing inherited properties from RequestOptionsBase (and thus I couldn't add the spanOptions).
I fixed this by just flattening them out into their own classes which appears to have solved it and was going to happen anyways since I need to do something similar to improve doc generation.