Skip to content

Conversation

@emschwartz
Copy link
Contributor

@emschwartz emschwartz commented May 24, 2023

This adds a Layer for tracing that exposes the Span fields to autometrics. It can then look for a field called trace_id and then automatically attach that as an exemplar for the metrics it generates.

TODO:

  • In the tracing example, run Prometheus with the --enable-feature=exemplar-storage flag and actually scrape the metrics and exemplars

Resolves #26

Copy link
Contributor

@gagbo gagbo left a comment

Choose a reason for hiding this comment

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

LGTM! That was a lot easier to implement than I thought it would :) I just added a few non-blocking nitpicks

@hatchan hatchan closed this May 25, 2023
@hatchan hatchan reopened this May 25, 2023
@hatchan
Copy link
Contributor

hatchan commented May 25, 2023

Already discussed out of bands, but I do feel like we should support the opentelemetry-otlp crate, which will be what most users will be using that are using the tracing crate. This crate will handle crossing the bridge from the tracing crate to the opentelemetry sdk. You would be able to use the following snippet to fetch the trace_id: Span::current().context().span().span_context().trace_id();

So in that sense I do agree with @gagbo that that maybe it would make sense to use a different name for the field as otherwise it would be confusing with the actual tracing.

@emschwartz emschwartz merged commit 810cef5 into main May 26, 2023
@emschwartz emschwartz deleted the exemplars-tracing branch May 26, 2023 06:05
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.

Add support for adding exemplars?

4 participants