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

metrics-generator: expose max_active_series as a metric #1471

Merged
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* [FEATURE] metrics-generator: support per-tenant processor configuration [#1434](https://github.com/grafana/tempo/pull/1434) (@kvrhdn)
* [FEATURE] Include rollout dashboard [#1456](https://github.com/grafana/tempo/pull/1456) (@zalegrala)
* [ENHANCEMENT] Added the ability to have a per tenant max search duration. [#1421](https://github.com/grafana/tempo/pull/1421) (@joe-elliott)
* [ENHANCEMENT] Azure Backend: Add support for authentication with Managed Identities. [#1457](https://github.com/grafana/tempo/pull/1457) (@joe-elliott)
* [ENHANCEMENT] metrics-generator: expose max_active_series as a metric [#1471](https://github.com/grafana/tempo/pull/1471) (@kvrhdn)
* [BUGFIX] Fix nil pointer panic when the trace by id path errors. [#1441](https://github.com/grafana/tempo/pull/1441) (@joe-elliott)
* [ENHANCEMENT] Azure Backend: Add support for authentication with Managed Identities.

## v1.4.1 / 2022-05-05

Expand Down
3 changes: 2 additions & 1 deletion integration/e2e/config-metrics-generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ memberlist:
- tempo_e2e-metrics-generator:7946

overrides:
metrics_generator_processors: [service-graphs, span-metrics]
metrics_generator_processors: [service-graphs, span-metrics]
metrics_generator_max_active_series: 1000
1 change: 1 addition & 0 deletions integration/e2e/metrics_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func TestMetricsGenerator(t *testing.T) {
assert.NoError(t, tempoMetricsGenerator.WaitSumMetrics(e2e.Equals(2), "tempo_metrics_generator_spans_received_total"))

assert.NoError(t, tempoMetricsGenerator.WaitSumMetrics(e2e.Equals(23), "tempo_metrics_generator_registry_active_series"))
assert.NoError(t, tempoMetricsGenerator.WaitSumMetrics(e2e.Equals(1000), "tempo_metrics_generator_registry_max_active_series"))
assert.NoError(t, tempoMetricsGenerator.WaitSumMetrics(e2e.Equals(23), "tempo_metrics_generator_registry_series_added_total"))
}

Expand Down
10 changes: 10 additions & 0 deletions modules/generator/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ var (
Name: "metrics_generator_registry_active_series",
Help: "The active series per tenant",
}, []string{"tenant"})
metricMaxActiveSeries = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "tempo",
Name: "metrics_generator_registry_max_active_series",
Help: "The maximum active series per tenant",
}, []string{"tenant"})
metricTotalSeriesAdded = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "tempo",
Name: "metrics_generator_registry_series_added_total",
Expand Down Expand Up @@ -63,6 +68,7 @@ type ManagedRegistry struct {

logger log.Logger
metricActiveSeries prometheus.Gauge
metricMaxActiveSeries prometheus.Gauge
metricTotalSeriesAdded prometheus.Counter
metricTotalSeriesRemoved prometheus.Counter
metricTotalSeriesLimited prometheus.Counter
Expand Down Expand Up @@ -105,6 +111,7 @@ func New(cfg *Config, overrides Overrides, tenant string, appendable storage.App

logger: logger,
metricActiveSeries: metricActiveSeries.WithLabelValues(tenant),
metricMaxActiveSeries: metricMaxActiveSeries.WithLabelValues(tenant),
metricTotalSeriesAdded: metricTotalSeriesAdded.WithLabelValues(tenant),
metricTotalSeriesRemoved: metricTotalSeriesRemoved.WithLabelValues(tenant),
metricTotalSeriesLimited: metricTotalSeriesLimited.WithLabelValues(tenant),
Expand Down Expand Up @@ -196,6 +203,9 @@ func (r *ManagedRegistry) collectMetrics(ctx context.Context) {
r.activeSeries.Store(activeSeries)
r.metricActiveSeries.Set(float64(activeSeries))

maxActiveSeries := r.overrides.MetricsGeneratorMaxActiveSeries(r.tenant)
r.metricMaxActiveSeries.Set(float64(maxActiveSeries))

err = appender.Commit()
if err != nil {
return
Expand Down