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

Distributor: small tracing improvements #8613

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented Jul 4, 2024

What this PR does

Add spans for sending to ingesters and partitions. This helps to group potentially hundreds of spans when viewing a trace.

Also break out the number of histograms and put that as a tag on the trace; it can be of interest.

Checklist

  • NA Tests updated.
  • NA Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • NA about-versioning.md updated with experimental features.

@bboreham bboreham requested a review from a team as a code owner July 4, 2024 16:21
Comment on lines +1580 to +1550
span, ctx := opentracing.StartSpanFromContext(ctx, "Distributor.sendWriteRequestToIngesters")
span.SetTag("write.series", len(req.Timeseries))
defer span.Finish()
Copy link
Contributor

Choose a reason for hiding this comment

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

The functions inside ring.DoBatchWithOptions here do some funky dancing with the context (note the remoteRequestContext). Are you sure this span will be linked as the parent of those that are created down the c.Push calls below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good call-out, but I think the code I wrote is ok.
remoteRequestContext() creates a child context of ctx so things ought to look OK in the trace viewer.
And remoteRequestContext() is intended to be called once the first call is ready, so we don't want to do it at the beginning of this function.

Copy link
Contributor

@narqo narqo Aug 15, 2024

Choose a reason for hiding this comment

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

Only to double-check: looking at an example of a trace below 👇 I believe, the changes here will put the new Distributor.sendWriteRequestToIngesters span to be parallel to GEM's Distributor.biPushWrapper and the first /cortex.Ingester/Push (i.e. won't make the /cortex.Ingester/Push spans the children of the sendWriteRequestToIngesters span).

Is this still fine? Because this seems going against to what you mentioned in the description ("This helps to group potentially hundreds of spans when viewing a trace")

Screenshot 2024-08-15 at 17 11 36

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably best not to discuss GEM in the public repo, but I am removing that span in the PR you can see linked.

Add spans for sending to ingesters and partitions.  This helps to group
potentially hundreds of spans when viewing a trace.

Also break out the number of histograms and put that as a tag on the
trace; it can be of interest.
@bboreham bboreham force-pushed the distributor-tracing branch from 986b224 to a513435 Compare August 14, 2024 13:54
@narqo
Copy link
Contributor

narqo commented Sep 27, 2024

The CHANGELOG has just been cut to prepare for the next release. Please rebase main and eventually move the CHANGELOG entry added / updated in this PR to the top of the CHANGELOG.md document. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants