From 64127ea7bdbcc09f4b6a3951315056108b31e40a Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Tue, 20 Aug 2024 13:45:16 -0400 Subject: [PATCH] Ingestion data: usage stats (#3983) * usage stats Signed-off-by: Joe Elliott * changelog Signed-off-by: Joe Elliott --------- Signed-off-by: Joe Elliott --- CHANGELOG.md | 2 ++ modules/distributor/distributor.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09ae27b285a..d34d39d7816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## main / unreleased +* [ENHANCEMENT] Add bytes and spans received to usage stats [#3983](https://github.com/grafana/tempo/pull/3983) (@joe-elliott) + # v2.6.0-rc.0 * [CHANGE] **BREAKING CHANGE** Remove `autocomplete_filtering_enabled` feature flag [#3729](https://github.com/grafana/tempo/pull/3729) (@mapno) diff --git a/modules/distributor/distributor.go b/modules/distributor/distributor.go index b56d2d52314..ca99bb710e2 100644 --- a/modules/distributor/distributor.go +++ b/modules/distributor/distributor.go @@ -34,6 +34,7 @@ import ( "github.com/grafana/tempo/pkg/model" "github.com/grafana/tempo/pkg/tempopb" v1 "github.com/grafana/tempo/pkg/tempopb/trace/v1" + "github.com/grafana/tempo/pkg/usagestats" tempo_util "github.com/grafana/tempo/pkg/util" "github.com/grafana/tempo/pkg/validation" @@ -109,6 +110,9 @@ var ( Name: "distributor_metrics_generator_clients", Help: "The current number of metrics-generator clients.", }) + + statBytesReceived = usagestats.NewCounter("distributor_bytes_received") + statSpansReceived = usagestats.NewCounter("distributor_spans_received") ) // rebatchedTrace is used to more cleanly pass the set of data @@ -353,6 +357,8 @@ func (d *Distributor) PushTraces(ctx context.Context, traces ptrace.Traces) (*te metricBytesIngested.WithLabelValues(userID).Add(float64(size)) metricSpansIngested.WithLabelValues(userID).Add(float64(spanCount)) + statBytesReceived.Inc(int64(size)) + statSpansReceived.Inc(int64(spanCount)) keys, rebatchedTraces, err := requestsByTraceID(batches, userID, spanCount) if err != nil {