@@ -73,7 +73,8 @@ func (r *Reconciler) reconcilePGMonitorExporter(ctx context.Context,
7373 // We use this ImageID and the setup.sql file in the hash we make to see if the operator needs to rerun
7474 // the `EnableExporterInPostgreSQL` funcs; that way we are always running
7575 // that function against an updated and running pod.
76- if pgmonitor .ExporterEnabled (cluster ) {
76+
77+ if pgmonitor .ExporterEnabled (cluster ) || feature .Enabled (ctx , feature .OpenTelemetryMetrics ) {
7778 sql , err := os .ReadFile (fmt .Sprintf ("%s/pg%d/setup.sql" , pgmonitor .GetQueriesConfigDir (ctx ), cluster .Spec .PostgresVersion ))
7879 if err != nil {
7980 return err
@@ -110,7 +111,7 @@ func (r *Reconciler) reconcilePGMonitorExporter(ctx context.Context,
110111 return pgmonitor .EnableExporterInPostgreSQL (ctx , exec , monitoringSecret , pgmonitor .ExporterDB , setup )
111112 }
112113
113- if ! pgmonitor .ExporterEnabled (cluster ) {
114+ if ! pgmonitor .ExporterEnabled (cluster ) && ! feature . Enabled ( ctx , feature . OpenTelemetryMetrics ) {
114115 action = func (ctx context.Context , exec postgres.Executor ) error {
115116 return pgmonitor .DisableExporterInPostgreSQL (ctx , exec )
116117 }
@@ -168,7 +169,7 @@ func (r *Reconciler) reconcileMonitoringSecret(
168169 return nil , err
169170 }
170171
171- if ! pgmonitor .ExporterEnabled (cluster ) {
172+ if ! pgmonitor .ExporterEnabled (cluster ) && ! feature . Enabled ( ctx , feature . OpenTelemetryMetrics ) {
172173 // TODO: Checking if the exporter is enabled to determine when monitoring
173174 // secret should be created. If more tools are added to the monitoring
174175 // suite, they could need the secret when the exporter is not enabled.
@@ -259,7 +260,7 @@ func addPGMonitorExporterToInstancePodSpec(
259260 template * corev1.PodTemplateSpec ,
260261 exporterQueriesConfig , exporterWebConfig * corev1.ConfigMap ) error {
261262
262- if ! pgmonitor .ExporterEnabled (cluster ) {
263+ if ! pgmonitor .ExporterEnabled (cluster ) && ! feature . Enabled ( ctx , feature . OpenTelemetryMetrics ) {
263264 return nil
264265 }
265266
@@ -407,7 +408,7 @@ func (r *Reconciler) reconcileExporterWebConfig(ctx context.Context,
407408 return nil , err
408409 }
409410
410- if ! pgmonitor .ExporterEnabled (cluster ) || cluster .Spec .Monitoring .PGMonitor .Exporter .CustomTLSSecret == nil {
411+ if ! pgmonitor .ExporterEnabled (cluster ) || feature . Enabled ( ctx , feature . OpenTelemetryMetrics ) || cluster .Spec .Monitoring .PGMonitor .Exporter .CustomTLSSecret == nil {
411412 // We could still have a NotFound error here so check the err.
412413 // If no error that means the configmap is found and needs to be deleted
413414 if err == nil {
0 commit comments