-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Tempo: Add time range to tags and tag value requests #107872
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
Conversation
💻 Deploy preview deleted. |
The **Tags time range** modifies how tags queries are run. | ||
When enabled, tags and tag values queries will include the time range. | ||
This setting is disabled by default. | ||
The start time is set to 15 minutes before end time to avoid searching over a long range of time while still allowing users to retrieve tags and tag values in the past. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be only me but my first impression was that start time is shifted but it seems like it's the other way round: "start time matches the start time in. the current time range and the end time is set to 15 minutes after the start".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it's used only with v2, not sure if need to mention it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some updates here but didn't actually mention anything about v1 / v2. It's been a long time since we made any changes to v1. We should really remove v1 as it's from a much older Tempo version.
I tried it in Explore and the range is applied nicely on load, but doesn't seem to be updated if the range changes: Screen.Recording.2025-07-10.at.13.56.57.movLoki plugin is doing this but checking if time range provided to the component changed:
|
|
||
| Name | Description | | ||
| ----------------- | ---------------------------------------- | | ||
| **Last 30 mins** | Last 30 mins of selected range. `1800` | |
Check failure
Code scanning / Vale
Did you really mean 'mins'? The Grafana dictionary might not know of this word yet
@ifrost in terms of listening for changes and recalling the endpoint - initially I felt like this could be too much for the user to be calling the tags again when the time range is changed (and instead refresh) but it's just going to be more confusing to do that so I've pushed a commit to listen for changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public/app/plugins/datasource/tempo/configuration/TagsTimeRangeSettings.tsx
Outdated
Show resolved
Hide resolved
// Check if we need to refetch tags due to range changes (minute-level granularity) | ||
const shouldRefetch = this.shouldRefreshLabels(range, this.previousRange); | ||
|
||
if (!this.startTask || shouldRefetch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this cause issues if the previous request is still pending? Do we cancel ongoing requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing it out it does not seem to cause issue, just creates another request if the range changes before the other one returns. I don't think Tempo allows us to cancel requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good! Left a couple of comments to make the code slightly cleaner.
What is this feature?
Adds time range to tags and tag value requests, which can be configured in the data source settings.
Why do we need this feature?
Users may have tags or tag values that existed at a time in the past, rather than the last 15 minutes.
Who is this feature for?
Tempo users.
Which issue(s) does this PR fix?:
Fixes #81916