Skip to content

Commit

Permalink
Refactor logic in PrometheusK8s() to decide if remote-write needs to …
Browse files Browse the repository at this point in the history
…be configured or not for telemetry
  • Loading branch information
simonpasquier committed Dec 22, 2022
1 parent d5c5478 commit e9b7689
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ func (f *Factory) PrometheusK8s(grpcTLS *v1.Secret, trustedCABundleCM *v1.Config
}

clusterID := f.config.ClusterMonitoringConfiguration.TelemeterClientConfig.ClusterID
if telemetrySecret != nil {
if f.config.ClusterMonitoringConfiguration.TelemeterClientConfig.IsEnabled() && f.config.RemoteWrite {
selectorRelabelConfig, err := promqlgen.LabelSelectorsToRelabelConfig(f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.TelemetryMatches)
if err != nil {
return nil, errors.Wrap(err, "generate label selector relabel config")
Expand Down
3 changes: 0 additions & 3 deletions pkg/tasks/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,6 @@ func (t *PrometheusTask) create(ctx context.Context) error {
if err = t.client.DeleteSecret(ctx, telemetrySecret); err != nil {
return errors.Wrap(err, "deleting Prometheus telemetry secret failed")
}

// Reset variable to not send telemetry via remote-write.
telemetrySecret = nil
}

{
Expand Down

0 comments on commit e9b7689

Please sign in to comment.