Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per tenant bytes counter #331

Merged
merged 4 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [ENHANCEMENT] Add warnings for suspect configs. [#294](https://github.com/grafana/tempo/pull/294)
* [ENHANCEMENT] Add command line flags for s3 credentials. [#308](https://github.com/grafana/tempo/pull/308)
* [ENHANCEMENT] Support multiple authentication methods for S3 (IRSA, IAM role, static). [#320](https://github.com/grafana/tempo/pull/320)
* [ENHANCEMENT] Add per tenant bytes counter. [#331](https://github.com/grafana/tempo/pull/331)
* [BUGFIX] S3 multi-part upload errors [#306](https://github.com/grafana/tempo/pull/325)
* [BUGFIX] Increase Prometheus `notfound` metric on tempo-vulture. [#301](https://github.com/grafana/tempo/pull/301)
* [BUGFIX] Return 404 if searching for a tenant id that does not exist in the backend. [#321](https://github.com/grafana/tempo/pull/321)
Expand Down
10 changes: 8 additions & 2 deletions modules/ingester/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ var (
Name: "ingester_traces_created_total",
Help: "The total number of traces created per tenant.",
}, []string{"tenant"})
metricBytesWrittenTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "tempo",
Name: "ingester_bytes_written_total",
Help: "The total bytes written per tenant.",
}, []string{"tenant"})
metricBlocksClearedTotal = promauto.NewCounter(prometheus.CounterOpts{
Namespace: "tempo",
Name: "ingester_blocks_cleared_total",
Expand All @@ -52,6 +57,7 @@ type instance struct {

instanceID string
tracesCreatedTotal prometheus.Counter
bytesWrittenTotal prometheus.Counter
limiter *Limiter
wal *tempodb_wal.WAL
}
Expand All @@ -62,6 +68,7 @@ func newInstance(instanceID string, limiter *Limiter, wal *tempodb_wal.WAL) (*in

instanceID: instanceID,
tracesCreatedTotal: metricTracesCreatedTotal.WithLabelValues(instanceID),
bytesWrittenTotal: metricBytesWrittenTotal.WithLabelValues(instanceID),
limiter: limiter,
wal: wal,
}
Expand Down Expand Up @@ -111,12 +118,11 @@ func (i *instance) CutCompleteTraces(cutoff time.Duration, immediate bool) error
if err != nil {
return err
}

err = i.headBlock.Write(trace.traceID, out)
if err != nil {
return err
}

i.bytesWrittenTotal.Add(float64(len(out)))
delete(i.traces, key)
}
}
Expand Down