Skip to content

Commit

Permalink
Fix head series query (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoBrigitte authored Oct 10, 2024
1 parent a76f1bf commit 463ad6c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- [Alloy] Enable VPA for AlloyMetrics
- Change the PromQL query used to determine the amount of head series when scaling Prometheus Agent and Alloy ([#74](https://github.com/giantswarm/observability-operator/pull/74))

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitoring/alloy/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (a *Service) GenerateAlloyMonitoringConfigMapData(ctx context.Context, curr
}

// Compute the number of shards based on the number of series.
query := fmt.Sprintf(`sum(max_over_time(prometheus_remote_write_wal_storage_active_series{cluster_id="%s", component_id="prometheus.remote_write.default", service="%s"}[6h]))`, cluster.Name, commonmonitoring.AlloyMonitoringAgentAppName)
query := fmt.Sprintf(`sum(max_over_time((sum(prometheus_remote_write_wal_storage_active_series{cluster_id="%s", component_id="prometheus.remote_write.default", service="%s"})by(pod))[6h:1h]))`, cluster.Name, commonmonitoring.AlloyMonitoringAgentAppName)
headSeries, err := querier.QueryTSDBHeadSeries(ctx, query)
if err != nil {
logger.Error(err, "alloy-service - failed to query head series")
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitoring/prometheusagent/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (pas PrometheusAgentService) buildRemoteWriteConfig(ctx context.Context,
}

// Compute the number of shards based on the number of series.
query := fmt.Sprintf("sum(max_over_time(prometheus_agent_active_series{cluster_id=\"%s\"}[6h]))", cluster.Name)
query := fmt.Sprintf(`sum(max_over_time((sum(prometheus_agent_active_series{cluster_id="%s"})by(pod))[6h:1h]))`, cluster.Name)
headSeries, err := querier.QueryTSDBHeadSeries(ctx, query)
if err != nil {
logger.Error(err, "failed to query head series")
Expand Down

0 comments on commit 463ad6c

Please sign in to comment.