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

tracing: track query sent to prometheus via remote read api #2145

Merged

Conversation

igorwwwwwwwwwwwwwwwwwwww
Copy link
Contributor

This patch extends tracing to include a prometheus.query tag for queries against the prometheus remote read API (/api/v1/read).

Previously there wasn't much information about the call being made, since that API uses protobuf over POST bodies. Now there is a JSON encoding of the protobuf request body in the trace.

One potential downside of this change is that there is JSON encoding and allocation overhead on every request. I wasn't able to find an easy way to make those conditional (input very welcome).

I also moved spanReqDo.Finish() before the error handling. I believe we want to finish the span in any case -- though if leaving it open was intentional, I'm happy to change it back.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • tracing: Add prometheus.query tag to query_prometheus_request span

Verification

I ran thanos locally with tracing configured for elastic APM and confirmed the addition of the prometheus.query tag. Example value:

{"start_timestamp_ms":1581930268943,"end_timestamp_ms":1581934168943,"matchers":[{"name":"__name__","value":"up"}]}

Signed-off-by: Igor Wiedler <iwiedler@gitlab.com>
Signed-off-by: Igor Wiedler <iwiedler@gitlab.com>
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.

I think marshalling overhead is super small here, so happy with this 👍

LGTM, thanks!

@squat squat merged commit 88004d1 into thanos-io:master Feb 17, 2020
vankop pushed a commit to monitoring-tools/thanos that referenced this pull request Feb 28, 2020
…o#2145)

* tracing: track query sent to prometheus via remote read api

Signed-off-by: Igor Wiedler <iwiedler@gitlab.com>

* add CHANGELOG entry

Signed-off-by: Igor Wiedler <iwiedler@gitlab.com>
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.

None yet

3 participants