Skip to content

Commit

Permalink
pyroscope-receiver: remove service label from hists
Browse files Browse the repository at this point in the history
Prometheus histograms are very expensive. This change removes service_name label from histograms, because it can explode cardinality.
  • Loading branch information
tomershafir committed Oct 8, 2024
1 parent 28f4e7c commit d60576d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions receiver/pyroscopereceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (r *pyroscopeReceiver) readProfiles(ctx context.Context, req *http.Request,
return logs, fmt.Errorf("failed to decompress body: %w", err)
}
// TODO: try measure compressed size
otelcolReceiverPyroscopeRequestBodyUncompressedSizeBytes.Record(ctx, int64(buf.Len()), metric.WithAttributeSet(*newOtelcolAttrSetPayloadSizeBytes(pm.name, formatJfr, "")))
otelcolReceiverPyroscopeRequestBodyUncompressedSizeBytes.Record(ctx, int64(buf.Len()), metric.WithAttributeSet(*newOtelcolAttrSetPayloadSizeBytes(formatJfr, "")))
resetHeaders(req)

md := profile_types.Metadata{SampleRateHertz: 0}
Expand Down Expand Up @@ -422,16 +422,16 @@ func (r *pyroscopeReceiver) readProfiles(ctx context.Context, req *http.Request,
)
}
// sz may be 0 and it will be recorded
otelcolReceiverPyroscopeParsedBodyUncompressedSizeBytes.Record(ctx, int64(sz), metric.WithAttributeSet(*newOtelcolAttrSetPayloadSizeBytes(pm.name, formatPprof, "")))
otelcolReceiverPyroscopeParsedBodyUncompressedSizeBytes.Record(ctx, int64(sz), metric.WithAttributeSet(*newOtelcolAttrSetPayloadSizeBytes(formatPprof, "")))
return logs, nil
}

func ns(sec uint64) uint64 {
return sec * 1e9
}

func newOtelcolAttrSetPayloadSizeBytes(service string, typ string, encoding string) *attribute.Set {
s := attribute.NewSet(attribute.KeyValue{Key: keyService, Value: attribute.StringValue(service)}, attribute.KeyValue{Key: "type", Value: attribute.StringValue(typ)}, attribute.KeyValue{Key: "encoding", Value: attribute.StringValue(encoding)})
func newOtelcolAttrSetPayloadSizeBytes(typ string, encoding string) *attribute.Set {
s := attribute.NewSet(attribute.KeyValue{Key: "type", Value: attribute.StringValue(typ)}, attribute.KeyValue{Key: "encoding", Value: attribute.StringValue(encoding)})
return &s
}

Expand Down

0 comments on commit d60576d

Please sign in to comment.