-
Notifications
You must be signed in to change notification settings - Fork 550
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
MQE: Add support for label_join #10587
base: main
Are you sure you want to change the base?
Conversation
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.
Overall LGTM.
Could you please enable the existing label_join
benchmark in pkg/streamingpromql/benchmarks/benchmarks.go
and post the comparison between MQE and Prometheus' engine?
@@ -17,6 +18,43 @@ import ( | |||
"github.com/grafana/mimir/pkg/streamingpromql/types" | |||
) | |||
|
|||
func LabelJoinFactory(dstLabelOp, separatorOp types.StringOperator, srcLabelOp []types.StringOperator) SeriesMetadataFunction { |
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.
[nit]
func LabelJoinFactory(dstLabelOp, separatorOp types.StringOperator, srcLabelOp []types.StringOperator) SeriesMetadataFunction { | |
func LabelJoinFactory(dstLabelOp, separatorOp types.StringOperator, srcLabelOps []types.StringOperator) SeriesMetadataFunction { |
@@ -173,6 +173,53 @@ func scalarToInstantVectorOperatorFactory(args []types.Operator, _ *limiting.Mem | |||
return scalars.NewScalarToInstantVector(inner, expressionPosition), nil | |||
} | |||
|
|||
func LabelJoinFunctionOperatorFactory(args []types.Operator, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, _ *annotations.Annotations, expressionPosition posrange.PositionRange, timeRange types.QueryTimeRange) (types.InstantVectorOperator, error) { | |||
if len(args) < 3 { |
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 worth adding a note here that it's valid to have no source label names.
} | ||
|
||
lb.Reset(seriesMetadata[i].Labels) | ||
lb.Set(dst, strings.Join(labelValues, separator)) |
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.
It'd be interesting to see if using the same strings.Builder
here for every series would be more efficient - strings.Join
uses a new strings.Builder
under the covers for each call, so reusing the same one ourselves should allow us to avoid allocating a new buffer for every series.
# Prometheus fails this with enableDelayedNameRemoval disabled | ||
# Can be tested against both once https://github.com/prometheus/prometheus/pull/15975 is merged |
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.
Looks like this has been merged - would you be able to vendor the fix into Mimir so we don't need to come back and move this later?
What this PR does
Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.