Skip to content

Commit

Permalink
Merge pull request #429 from vyzigold/fix_scrapeinterval
Browse files Browse the repository at this point in the history
[OSPRH-8074] Fix panic when missing ScrapeInterval
  • Loading branch information
openshift-merge-bot[bot] authored Jul 5, 2024
2 parents 3c3fb82 + 22ea660 commit a5011b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/metricstorage/service_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ func ServiceMonitor(
var scrapeInterval monv1.Duration
if instance.Spec.MonitoringStack != nil && instance.Spec.MonitoringStack.ScrapeInterval != "" {
scrapeInterval = monv1.Duration(instance.Spec.MonitoringStack.ScrapeInterval)
} else if instance.Spec.CustomMonitoringStack != nil && *instance.Spec.CustomMonitoringStack.PrometheusConfig.ScrapeInterval != monv1.Duration("") {
} else if instance.Spec.CustomMonitoringStack != nil &&
instance.Spec.CustomMonitoringStack.PrometheusConfig != nil &&
instance.Spec.CustomMonitoringStack.PrometheusConfig.ScrapeInterval != nil &&
*instance.Spec.CustomMonitoringStack.PrometheusConfig.ScrapeInterval != monv1.Duration("") {
scrapeInterval = *instance.Spec.CustomMonitoringStack.PrometheusConfig.ScrapeInterval
} else {
scrapeInterval = telemetryv1.DefaultScrapeInterval
Expand Down

0 comments on commit a5011b4

Please sign in to comment.