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 Sep 21, 2022
1 parent 6d9b79e commit c6d21a3
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 @@ -1637,7 +1637,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 @@ -323,9 +323,6 @@ func (t *PrometheusTask) Run(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 c6d21a3

Please sign in to comment.