Skip to content

Commit

Permalink
Check if map is initialized prior using it (kube-burner#711)
Browse files Browse the repository at this point in the history
## Type of change

- [ ] Refactor
- [ ] New feature
- [ ] Bug fix
- [x] Optimization
- [ ] Documentation Update

## Description

Let's check these maps are initialized before using them to prevent
potential issues

## Related Tickets & Documents

- Related Issue kube-burner/kube-burner-ocp#120
- Closes #

Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Oct 15, 2024
1 parent 1ffe5f8 commit 1413216
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/util/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ func ProcessMetricsScraperConfig(scraperConfig ScraperConfig) Scraper {
}
// Combine users provided metadata with metrics and summary metadata
for k, v := range userMetadata {
scraperConfig.SummaryMetadata[k] = v
scraperConfig.MetricsMetadata[k] = v
if scraperConfig.SummaryMetadata != nil {
scraperConfig.SummaryMetadata[k] = v
}
if scraperConfig.MetricsMetadata != nil {
scraperConfig.MetricsMetadata[k] = v
}
}
// MetricsEndpoint has preference over the configuration file
if scraperConfig.MetricsEndpoint != "" {
Expand Down

0 comments on commit 1413216

Please sign in to comment.