Skip to content
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

pkg/receive: eliminate duplicate tracing #1717

Merged
merged 1 commit into from
Nov 5, 2019

Conversation

squat
Copy link
Member

@squat squat commented Nov 5, 2019

The receive component currently has duplicate spans for requests handled
by its HTTP server. This is due to the fact that the server is
instrumented once using the global singleton tracer and then a second
time with the tracer configured via the CLI. This commit eliminates the
duplicate instrumentation via the global singleton in favor of the
explicit specified tracer, which is consistent with the practice of
other Thanos components.

Signed-off-by: Lucas Servén Marín [email protected]

Example of duplicate span:
image

Note that:

  • both /receive HTTP[server] and POST /api/v1/receive represent the same operation; and that
  • the span created by the global singleton, POST /api/v1/receive is erroneously setting the HTTP status code to 0.

The receive component currently has duplicate spans for requests handled
by its HTTP server. This is due to the fact that the server is
instrumented once using the global singleton tracer and then a second
time with the tracer configured via the CLI. This commit eliminates the
duplicate instrumentation via the global singleton in favor of the
explicit specified tracer, which is consistent with the practice of
other Thanos components.

Signed-off-by: Lucas Servén Marín <[email protected]>
Copy link
Contributor

@metalmatze metalmatze left a comment

Choose a reason for hiding this comment

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

Cool, this should declutter things, thanks!
Is Thanos using a global object that everything references? However, the Prometheus registry is passed by reference?

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Nicely spotted, thanks!

@squat
Copy link
Member Author

squat commented Nov 5, 2019

@metalmatze the tracing configuration is also typically passed explicitly, e.g. https://github.com/thanos-io/thanos/blob/master/cmd/thanos/query.go#L382,
https://github.com/thanos-io/thanos/blob/master/cmd/thanos/query.go#L400.

The receive component was the only component with a reference to the globaltracer, however this seems to have been left over from the initial implementation of the receiver.

@bwplotka bwplotka merged commit 5d936e2 into thanos-io:master Nov 5, 2019
@squat squat deleted the deduplicatetracing branch November 5, 2019 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants