-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
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
6778d35
to
a7c0789
Compare
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 | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Opened an issue: #26499. |
Description:
This PR adds a unit test to check for metric collisions in receivers which have metrics defined.
Link to tracking Issue:
#23375