-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add created_for_pv label to unused_disk_size_bytes metric #95
Conversation
This is tricky, I believe. In my point of view, you would be testing that Prometheus works on adding a label on a metric to the value that you're assigning, in other words, you would be testing Prometheus and not In any case, what would be needed instead is a test that proves that |
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.
LGTM but I'd like a few more reviewers to chime in before merging this.
I don't think you're necessarily testing Prometheus. We went down down this path in cloudcost-exporter to ensure the metrics we export have the correct set of labels and values given a set of responses from cloud providers. My philosophy around it is that once people start using the exporter, we have a contract on the metrics and want to ensure we don't have regressions. I'd say it's more of an integration/end to end test? FWIW, I found this pattern from a few prometheus-community maintained exporters:
With that though, the tests can be brittle and we occasionally have flaky tests due to race conditions. I don't think in this case it's worth it to add tests validating the exported metrics align with expectations. |
ee0cb33
to
d701500
Compare
d701500
to
a35e73a
Compare
There were a few tests missing for meta.go, so I've added them, even if not exactly within the scope of this PR. And cleaned up a function that wasn't being used, nor could be used across all three providers. My guess is it made sense in the first iteration of this project, but not now that it's mostly expected to work for all three major CSPs. |
@Pokom agreed, I don't think this case warrants risking having to maintain brittle tests. |
Adding this label to make my own life easier for a join I'm working on. I don't think it'll have much of an impact, since this metric already has the disk ID label, and the relationship between PV and disk should be 1 to 1. If I understand correctly, it should not affect current cardinality.
I've tested it out locally, but I don't really know how to add automated tests for the metrics in this file. Open to pointers if you have them, I think it'll be a nice improvement.