MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / ExporterEnabled

Function ExporterEnabled

internal/pgmonitor/util.go:30–46  ·  view source on GitHub ↗

ExporterEnabled returns true if the monitoring exporter is enabled

(ctx context.Context, cluster *v1beta1.PostgresCluster)

Source from the content-addressed store, hash-verified

28
29// ExporterEnabled returns true if the monitoring exporter is enabled
30func 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}

Calls 1

Tested by 1

TestExporterEnabledFunction · 0.68