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

feat: added min_over_time TraceQL metric #3975

Merged
merged 22 commits into from
Aug 30, 2024

Conversation

javiermolinar
Copy link
Contributor

@javiermolinar javiermolinar commented Aug 19, 2024

What this PR does:
It adds a new TraceQL metric min_over_time used to compute the minimum value of a span series over a specified date range.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@javiermolinar javiermolinar marked this pull request as draft August 19, 2024 10:44
@javiermolinar javiermolinar marked this pull request as ready for review August 19, 2024 14:27
pkg/traceql/ast.go Show resolved Hide resolved
pkg/traceql/ast.go Outdated Show resolved Hide resolved
pkg/traceql/ast_stringer.go Outdated Show resolved Hide resolved
pkg/traceql/engine_metrics.go Outdated Show resolved Hide resolved
pkg/traceql/engine_metrics.go Outdated Show resolved Hide resolved
pkg/traceql/engine_metrics.go Show resolved Hide resolved
pkg/traceql/engine_metrics.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

As discussed offline - we need to add a new aggregator for mode Sum/Final, which computes the min across time-series (i.e. the min of all mins), and use it in MetricsAggregate.initSum and initFinal. Right now it is still falling back to SimpleAdditionAggregator.

pkg/traceql/ast.go Show resolved Hide resolved
@javiermolinar javiermolinar requested a review from mdisibio August 23, 2024 14:43
@javiermolinar
Copy link
Contributor Author

Back to draft, we need to come out with a solution for missing/uninitialized time-series values

@javiermolinar javiermolinar marked this pull request as draft August 26, 2024 12:59
@knylander-grafana
Copy link
Contributor

Is this something we'll want to document?

@javiermolinar javiermolinar marked this pull request as ready for review August 28, 2024 15:41
@javiermolinar
Copy link
Contributor Author

Is this something we'll want to document?

Yes, once we agreed on a solution we should document this new function

@knylander-grafana
Copy link
Contributor

Is this something we'll want to document?

Yes, once we agreed on a solution we should document this new function

This may be a good spot for your content. The compare function content went on the traceql/metrics-queries.md file in the Functions section.

Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

This is looking great. I'm really happy with this PR because we are straightening up some ast and value handling quirks that needed it. There is 1 more required change to drop series with no values, and then 1 small nit that I would prefer but not blocking.

pkg/traceql/engine_metrics.go Outdated Show resolved Hide resolved
@javiermolinar
Copy link
Contributor Author

javiermolinar commented Aug 30, 2024

Is this something we'll want to document?

Yes, once we agreed on a solution we should document this new function

This may be a good spot for your content. The compare function content went on the traceql/metrics-queries.md file in the Functions section.

@knylander-grafana I've added some documentation. Maybe is a good idea to have a section for all the aggregation functions over_time. Like prometheus does

@javiermolinar javiermolinar requested a review from mdisibio August 30, 2024 11:07
Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

Nice work 👍

@knylander-grafana knylander-grafana added the type/docs Improvements or additions to documentation label Aug 30, 2024
@knylander-grafana
Copy link
Contributor

If you have a PR with doc updates, add the type/docs label to it please.

@mdisibio mdisibio merged commit 8c6519f into grafana:main Aug 30, 2024
18 checks passed
@knylander-grafana
Copy link
Contributor

knylander-grafana commented Aug 30, 2024

@knylander-grafana I've added some documentation. Maybe is a good idea to have a section for all the aggregation functions over_time. Like prometheus does

@javiermolinar Thank you for adding the doc! We have a doc issue to update the metrics query docs (they need some love).

Before we restructure sections in the page, we should look at the content on the metrics query pages to consider who our target audience is, what are the topics that audience needs to know, what are they interested in doing (determine any tasks -- which helps us create meaningful examples), etc.

The Prometheus example is a good way of just listing an item and defining what it does. It could be a good way to do an introduction to a section, and then provide either an example for every function (in which case you use the subheadings like we have) or your subheadings are focused on examples and use cases for the functions. Does that difference make sense? I'd love to see the latter (function list like Prom docs and then real-world examples and explanations), but it takes more time than providing the function heading, with a brief explanation, and then a simple example.

I've captured this conversation in the metrics query doc issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants