From 0f59c5466eb1ae0dedd4547dd9a04c004b3f3735 Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:32:52 +0100 Subject: [PATCH] fix deprecation warning by switching to DoBatchWithOptions Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> --- CHANGELOG.md | 1 + modules/distributor/distributor.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9242a2ab06..4433ae12148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## main / unreleased * [FEATURE] tempo-cli: support dropping multiple traces in a single operation [#4266](https://github.com/grafana/tempo/pull/4266) (@ndk) +* [CHANGE] fix deprecation warning by switching to DoBatchWithOptions [#4343](https://github.com/grafana/tempo/pull/4343) (@dastrobu) * [CHANGE] **BREAKING CHANGE** The Tempo serverless is now deprecated and will be removed in an upcoming release [#4017](https://github.com/grafana/tempo/pull/4017/) @electron0zero * [CHANGE] **BREAKING CHANGE** Change the AWS Lambda serverless build tooling output from "main" to "bootstrap". Refer to https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/ for migration steps [#3852](https://github.com/grafana/tempo/pull/3852) (@zatlodan) * [CHANGE] Add throughput and SLO metrics in the tags and tag values endpoints [#4148](https://github.com/grafana/tempo/pull/4148) (@electron0zero) diff --git a/modules/distributor/distributor.go b/modules/distributor/distributor.go index 87e57e271b5..b77e66d8945 100644 --- a/modules/distributor/distributor.go +++ b/modules/distributor/distributor.go @@ -424,7 +424,7 @@ func (d *Distributor) sendToIngestersViaBytes(ctx context.Context, userID string writeRing := d.ingestersRing.ShuffleShard(userID, d.overrides.IngestionTenantShardSize(userID)) - err := ring.DoBatch(ctx, op, writeRing, keys, func(ingester ring.InstanceDesc, indexes []int) error { + err := ring.DoBatchWithOptions(ctx, op, writeRing, keys, func(ingester ring.InstanceDesc, indexes []int) error { localCtx, cancel := context.WithTimeout(ctx, d.clientCfg.RemoteTimeout) defer cancel() localCtx = user.InjectOrgID(localCtx, userID) @@ -459,7 +459,7 @@ func (d *Distributor) sendToIngestersViaBytes(ctx context.Context, userID string d.processPushResponse(pushResponse, numSuccessByTraceIndex, lastErrorReasonByTraceIndex, numOfTraces, indexes) return nil - }, func() {}) + }, ring.DoBatchOptions{}) // if err != nil, we discarded everything because of an internal error (like "context cancelled") if err != nil { overrides.RecordDiscardedSpans(totalSpanCount, reasonInternalError, userID) @@ -482,7 +482,7 @@ func (d *Distributor) sendToGenerators(ctx context.Context, userID string, keys readRing := d.generatorsRing.ShuffleShard(userID, d.overrides.MetricsGeneratorRingSize(userID)) - err := ring.DoBatch(ctx, op, readRing, keys, func(generator ring.InstanceDesc, indexes []int) error { + err := ring.DoBatchWithOptions(ctx, op, readRing, keys, func(generator ring.InstanceDesc, indexes []int) error { localCtx, cancel := context.WithTimeout(ctx, d.generatorClientCfg.RemoteTimeout) defer cancel() localCtx = user.InjectOrgID(localCtx, userID) @@ -506,7 +506,7 @@ func (d *Distributor) sendToGenerators(ctx context.Context, userID string, keys return fmt.Errorf("failed to push spans to generator: %w", err) } return nil - }, func() {}) + }, ring.DoBatchOptions{}) return err }