chore: skip creating one span-traces for every pushed spans in metrics generator (#4844)

* chore: skip creating one span-traces for every pushed spans in metrics generator

* changelog
This commit is contained in:
Javi
2025-03-13 11:22:03 +01:00
committed by GitHub
parent 3555fdf776
commit ba601dddac
3 changed files with 4 additions and 24 deletions

View File

@ -42,6 +42,7 @@ configurable via the throughput_bytes_slo field, and it will populate op="traces
* [ENHANCEMENT] update dskit to latest version[#4681](https://github.com/grafana/tempo/pull/4681) (@javiermolinar)
* [ENHANCEMENT] Improve TraceQL perf by reverting EqualRowNumber to an inlineable function.[#4705](https://github.com/grafana/tempo/pull/4705) (@joe-elliott)
* [ENHANCEMENT] rhythm: fair partition consumption in blockbuilders[#4655](https://github.com/grafana/tempo/pull/4655) (@javiermolinar)
* [ENHANCEMENT] Skip creating one span-traces for every pushed spans in metrics generator [#4844](https://github.com/grafana/tempo/pull/4844) (@javiermolinar)
* [ENHANCEMENT] TraceQL: add support for querying by parent span id [#4692](https://github.com/grafana/tempo/pull/4692) (@ie-pham)
* [ENHANCEMENT] metrics-generator: allow skipping localblocks and consuming from a different source of data [#4686](https://github.com/grafana/tempo/pull/4686) (@flxbk)
* [ENHANCEMENT] compactor: restore dedicated columns logging for completed blocks

View File

@ -13,7 +13,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/prometheus/util/strutil"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.25.0"
@ -27,8 +26,6 @@ import (
tempo_util "github.com/grafana/tempo/pkg/util"
)
var tracer = otel.Tracer("modules/generator/processor/servicegraphs")
var (
metricDroppedSpans = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "tempo",
@ -155,10 +152,7 @@ func (p *Processor) Name() string {
return Name
}
func (p *Processor) PushSpans(ctx context.Context, req *tempopb.PushSpansRequest) {
_, span := tracer.Start(ctx, "servicegraphs.PushSpans")
defer span.End()
func (p *Processor) PushSpans(_ context.Context, req *tempopb.PushSpansRequest) {
if err := p.consume(req.Batches); err != nil {
var tmsErr *tooManySpansError
if errors.As(err, &tmsErr) {

View File

@ -9,7 +9,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/util/strutil"
"go.opentelemetry.io/otel"
gen "github.com/grafana/tempo/modules/generator/processor"
processor_util "github.com/grafana/tempo/modules/generator/processor/util"
@ -30,8 +29,6 @@ const (
targetInfo = "traces_target_info"
)
var tracer = otel.Tracer("modules/generator/processor/spanmetrics")
type sanitizeFn func(string) string
type Processor struct {
@ -122,10 +119,7 @@ func (p *Processor) Name() string {
return Name
}
func (p *Processor) PushSpans(ctx context.Context, req *tempopb.PushSpansRequest) {
_, span := tracer.Start(ctx, "spanmetrics.PushSpans")
defer span.End()
func (p *Processor) PushSpans(_ context.Context, req *tempopb.PushSpansRequest) {
p.aggregateMetrics(req.Batches)
}
@ -283,7 +277,7 @@ func GetTargetInfoAttributesValues(keys, values *[]string, attributes []*v1_comm
for _, attrs := range attributes {
// ignoring job and instance
key := attrs.Key
if key != "service.name" && key != "service.namespace" && key != "service.instance.id" && !Contains(key, exclude) {
if key != "service.name" && key != "service.namespace" && key != "service.instance.id" && !slices.Contains(exclude, key) {
*keys = append(*keys, SanitizeLabelNameWithCollisions(key, intrinsicLabels, sanitizeFn))
value := tempo_util.StringifyAnyValue(attrs.Value)
*values = append(*values, value)
@ -301,12 +295,3 @@ func SanitizeLabelNameWithCollisions(name string, dimensions []string, sansaniti
return sanitized
}
func Contains(key string, list []string) bool {
for _, exclude := range list {
if key == exclude {
return true
}
}
return false
}