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

[TraceQL Metrics] New baseline comparison function #3695

Merged
merged 23 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a0eb86b
Initial working version of compare
mdisibio May 20, 2024
f8e3830
Clean/rename
mdisibio May 20, 2024
fb0f7ee
Redo meta labels for type and error. Add required parameter for max v…
mdisibio May 21, 2024
cd04ee9
Merge branch 'main' into baseline-compare
mdisibio May 21, 2024
4b9f50d
Add selectAll support to vParquet4
mdisibio May 21, 2024
4809721
vp2 unsupported
mdisibio May 21, 2024
0afea30
comment out test for now
mdisibio May 21, 2024
c78ecbc
Rename select all field
mdisibio May 21, 2024
fd51d40
lint
mdisibio May 21, 2024
5989ad4
compare() return topN and make it optional
mdisibio May 21, 2024
498fdc7
Add callback version of AllAttributes to avoid map alloc
mdisibio May 28, 2024
f33dc49
Fix lookup table
mdisibio Jun 3, 2024
f295662
Hideous but working version with totals per attribute and classification
mdisibio Jun 4, 2024
8aa1f37
less hideous, and restore full time series processing
mdisibio Jun 4, 2024
494feaf
instant-ish query
mdisibio Jun 6, 2024
201c93f
add selectall attributes
mdisibio Jun 7, 2024
29c72ac
Merge branch 'main' into baseline-compare
mdisibio Jun 7, 2024
56c86e5
Adding partial finished test for selectAll, blocked for now
mdisibio Jun 17, 2024
c814e50
lint
mdisibio Jun 17, 2024
fe0cd9e
Review feedback, reenable using traceid and traceDuration in the filter
mdisibio Jun 20, 2024
629ce92
changelog
mdisibio Jun 20, 2024
27ded60
Finish vp4 selectall test, refactor some methods to share with test
mdisibio Jun 20, 2024
7a49497
Fix comment and remove test hacks
mdisibio Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* [FEATURE] TraceQL support for link scope and link:traceID and link:spanID [#3741](https://github.com/grafana/tempo/pull/3741) (@stoewer)
* [FEATURE] TraceQL support for event scope and event:name intrinsic [#3708](https://github.com/grafana/tempo/pull/3708) (@stoewer)
* [FEATURE] Flush and query RF1 blocks for TraceQL metric queries [#3628](https://github.com/grafana/tempo/pull/3628) [#3691](https://github.com/grafana/tempo/pull/3691) [#3723](https://github.com/grafana/tempo/pull/3723) (@mapno)
* [FEATURE] Add new compare() metrics function [#3695](https://github.com/grafana/tempo/pull/3695) (@mdisibio)
* [ENHANCEMENT] Tag value lookup use protobuf internally for improved latency [#3731](https://github.com/grafana/tempo/pull/3731) (@mdisibio)
* [ENHANCEMENT] TraceQL metrics queries use protobuf internally for improved latency [#3745](https://github.com/grafana/tempo/pull/3745) (@mdisibio)
* [ENHANCEMENT] Improve use of OTEL semantic conventions on the service graph [#3711](https://github.com/grafana/tempo/pull/3711) (@zalegrala)
Expand Down
5 changes: 5 additions & 0 deletions modules/frontend/metrics_query_range_sharder.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ func (s *queryRangeSharder) toUpstreamRequest(ctx context.Context, req tempopb.Q
// Without alignment each refresh is shifted by seconds or even milliseconds and the time series
// calculations are sublty different each time. It's not wrong, but less preferred behavior.
func alignTimeRange(req *tempopb.QueryRangeRequest) {
if req.End-req.Start == req.Step {
// Instant query
return
}

// It doesn't really matter but the request fields are expected to be in nanoseconds.
req.Start = req.Start / req.Step * req.Step
req.End = req.End / req.Step * req.Step
Expand Down
6 changes: 6 additions & 0 deletions pkg/traceql/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ func (m *mockSpan) AllAttributes() map[Attribute]Static {
return m.attributes
}

func (m *mockSpan) AllAttributesFunc(cb func(Attribute, Static)) {
for k, v := range m.attributes {
cb(k, v)
}
}

func (m *mockSpan) ID() []byte {
return m.id
}
Expand Down
13 changes: 11 additions & 2 deletions pkg/traceql/engine_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/grafana/tempo/pkg/tempopb"
commonv1proto "github.com/grafana/tempo/pkg/tempopb/common/v1"
v1 "github.com/grafana/tempo/pkg/tempopb/common/v1"
"github.com/grafana/tempo/pkg/util"
"github.com/prometheus/prometheus/model/labels"
)
Expand Down Expand Up @@ -77,6 +78,14 @@ type Label struct {

type Labels []Label

func LabelsFromProto(ls []v1.KeyValue) Labels {
out := make(Labels, 0, len(ls))
for _, l := range ls {
out = append(out, Label{Name: l.Key, Value: StaticFromAnyValue(l.Value)})
}
return out
}

// String returns the prometheus-formatted version of the labels. Which is downcasting
// the typed TraceQL values to strings, with some special casing.
func (ls Labels) String() string {
Expand All @@ -98,7 +107,7 @@ func (ls Labels) String() string {
}

type TimeSeries struct {
Labels []Label
Labels Labels
Values []float64
}

Expand Down Expand Up @@ -578,7 +587,7 @@ func (e *Engine) CompileMetricsQueryRange(req *tempopb.QueryRangeRequest, dedupe

// optimize numerous things within the request that is specific to metrics.
func optimize(req *FetchSpansRequest) {
if !req.AllConditions {
if !req.AllConditions || req.SecondPassSelectAll {
return
}

Expand Down
Loading
Loading