Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmd/mdatagen] Add unit test for metric collisions. #24229

Closed

Conversation

mackjmr
Copy link
Member

@mackjmr mackjmr commented Jul 12, 2023

Description:
This PR adds a unit test to check for metric collisions in receivers which have metrics defined.

Link to tracking Issue:
#23375

@mackjmr mackjmr requested a review from a team July 12, 2023 09:13
@mackjmr mackjmr requested a review from dmitryax as a code owner July 12, 2023 09:13
@github-actions github-actions bot added the cmd/mdatagen mdatagen command label Jul 12, 2023
@songy23 songy23 added ready to merge Code review completed; ready to merge by maintainers Skip Changelog PRs that do not require a CHANGELOG.md entry labels Jul 12, 2023
cmd/mdatagen/validate_test.go Outdated Show resolved Hide resolved
@crobert-1
Copy link
Member

CI action failure is frequency of #24223.

This PR adds a unit test to check for metric collisions in receivers which have metrics defined.

Issue: open-telemetry#23375
Comment on lines +125 to +137
seen := make(map[string]string)
for receiver, metrics := range allMetrics {
for _, metricName := range metrics {
// TODO: Remove one https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/24009 and
// https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/24008 have been addressed.
if metricName == "container.cpu.utilization" || metricName == "container.memory.rss" {
continue
}
val, exists := seen[metricName]
assert.False(t, exists, fmt.Sprintf("Collision for metric %v in receivers %v and %v \n", metricName, receiver, val))
seen[metricName] = receiver
}
}
Copy link
Member

@dmitryax dmitryax Jul 20, 2023

Choose a reason for hiding this comment

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

I don't think we ever decided that each receiver must emit unique metric names. I'd say we should remove this section until this decision is made.

Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

I just realized that this whole test is about making sure that each receiver emits unique metrics which we don't have a rule for. I think we shouldn't introduce it until we decide on this rule

@atoulme atoulme removed the ready to merge Code review completed; ready to merge by maintainers label Jul 27, 2023
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 11, 2023
@github-actions
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Aug 26, 2023
@mackjmr
Copy link
Member Author

mackjmr commented Sep 7, 2023

Opened an issue: #26499.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/mdatagen mdatagen command Skip Changelog PRs that do not require a CHANGELOG.md entry Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants