ExporterEnabled returns true if the monitoring exporter is enabled
(ctx context.Context, cluster *v1beta1.PostgresCluster)
| 28 | |
| 29 | // ExporterEnabled returns true if the monitoring exporter is enabled |
| 30 | func ExporterEnabled(ctx context.Context, cluster *v1beta1.PostgresCluster) bool { |
| 31 | // If OpenTelemetry metrics are enabled for this cluster, that takes precedence |
| 32 | // over the postgres_exporter metrics. |
| 33 | if collector.OpenTelemetryMetricsEnabled(ctx, cluster) { |
| 34 | return false |
| 35 | } |
| 36 | if cluster.Spec.Monitoring == nil { |
| 37 | return false |
| 38 | } |
| 39 | if cluster.Spec.Monitoring.PGMonitor == nil { |
| 40 | return false |
| 41 | } |
| 42 | if cluster.Spec.Monitoring.PGMonitor.Exporter == nil { |
| 43 | return false |
| 44 | } |
| 45 | return true |
| 46 | } |