Skip to content

Conversation

dewey
Copy link
Member

@dewey dewey commented Feb 17, 2025

No description provided.

Copy link
Contributor

@marevers marevers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dewey dewey requested a review from Copilot March 20, 2025 12:15
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that query names are unique across jobs to prevent conflicts in Prometheus metrics.

  • Introduces a validation loop to detect duplicate query names.
  • Aborts exporter initialization with a descriptive error when duplicates are found.

for _, job := range cfg.Jobs {
for _, query := range job.Queries {
if _, ok := uniqueQueries[query.Name]; ok {
duplicateQueries = append(duplicateQueries, query.Name)
Copy link
Preview

Copilot AI Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate query names may be appended multiple times if encountered repeatedly, resulting in redundant entries in the error message.

Suggested change
duplicateQueries = append(duplicateQueries, query.Name)
if _, added := addedDuplicates[query.Name]; !added {
duplicateQueries = append(duplicateQueries, query.Name)
addedDuplicates[query.Name] = struct{}{}
}

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants