Skip to content

Commit

Permalink
Ingestion data: usage stats (#3983)
Browse files Browse the repository at this point in the history
* usage stats

Signed-off-by: Joe Elliott <[email protected]>

* changelog

Signed-off-by: Joe Elliott <[email protected]>

---------

Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott authored Aug 20, 2024
1 parent 0f0177c commit 64127ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 6 additions & 0 deletions modules/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 64127ea

Please sign in to comment.