Skip to content
This repository has been archived by the owner on Feb 12, 2025. It is now read-only.

Add tracing module #335

Merged
merged 6 commits into from
Oct 18, 2018
Merged

Add tracing module #335

merged 6 commits into from
Oct 18, 2018

Conversation

vladbarosan
Copy link

  • add tracing support. Instrumentation is done through a custom RoundTripper on the http client and through SDK function calls with the goal of correlating sdk calls with the api calls. Also convenience tracing calls are added.
  • remove usage of original request's context on LRO polling.

@ghost ghost assigned vladbarosan Oct 16, 2018
@ghost ghost added the review label Oct 16, 2018
@vladbarosan
Copy link
Author

Initially wanted to place this inside azure path as it makes more sense, but in that case would be painful to use it for adal. In the end I decided to use it for adal calls also since that would provide value to customers.

func Enable() (err error) {
Enabled = true
sampler = nil
Transport = &ochttp.Transport{Propagation: &tracecontext.HTTPFormat{}}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note we updated for the W3C's Trace Context for propagating across servers instead of the B3 default implementation. Since Trace Context is on its way of becoming the standard but still a draft a little torn here. @joshgav regarding the ARM tracing, for immediate practical effects using the Trace Context means having only 1 header with any custom key-value pairs as opposed to some predefined headers for the B3 propagation .

}

// Enable will start instrumentation for metrics and traces.
func Enable() (err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a matching Disable()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why they would want to disable once it started but who knows. good point will see if I can add it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If adding Disable() can be done in a non-breaking way then we don't have to hold up this PR for it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it could but still investigating if that might cause any issue. im still testing scenarios to see if anything breaks

Transport = http.DefaultTransport

// Enabled is the flag for marking if tracing is enabled.
Enabled = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect customers to use this value or is it purely for testing purposes? If it's the latter then perhaps we can not export it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or make an enabled() func that predicates on sampler being nil or not.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I was thinking they might use it to check if monitoring is enabled on the sdk. if we want we could leave it unexported and if there is a requirement we can export it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It might be better to make it Enabled() then so it's effectively read-only (I could see somebody setting it to false thinking it would turn it off).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough

@vladbarosan vladbarosan force-pushed the addMonitoring branch 2 times, most recently from 0588420 to 4f7ddca Compare October 18, 2018 22:16
@vladbarosan vladbarosan reopened this Oct 18, 2018
@ghost ghost added review and removed review labels Oct 18, 2018
@vladbarosan vladbarosan merged commit 4492bbb into Azure:master Oct 18, 2018
@ghost ghost removed the review label Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants