-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[exporter/prometheusremotewrite] respect integer exemplar values #36688
[exporter/prometheusremotewrite] respect integer exemplar values #36688
Conversation
// getHistogramDataPointWithExemplarsInt returns a HistogramDataPoint populating the exemplar with an int64 value. | ||
func getHistogramDataPointWithExemplarsInt(t *testing.T, time time.Time, value int64, traceID string, spanID string, attributeKey string, attributeValue string) pmetric.HistogramDataPoint { |
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 basically copy/paste the content of this function ⬇️
opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/testutils_test.go
Line 187 in dd600c1
func getHistogramDataPointWithExemplars(t *testing.T, time time.Time, value float64, traceID string, spanID string, attributeKey string, attributeValue string) pmetric.HistogramDataPoint { |
But changing the signature to receive an int64
value instead of a float64
one. Does this make sense?
I'm also added a comment in the top of the function, but I notice that most of the private functions doesn't have a comment, should I keep it?
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.
Maybe this is a good use case for generics?
func getHistogramDataPointWithExemplars[V int64 | float64](t *testing.T, time time.Time, value V, traceID string, spanID string, attributeKey string, attributeValue string) pmetric.HistogramDataPoint {
.
.
.
switch V.(type) {
case int64:
e.SetIntValue(value)
case float64:
e.SetDoubleValue(value)
}
.
.
.
}
We could avoid a little bit of code and the change is not thaaaat big to the original function
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 removed the new helper function that I created, and I added the generic
that you mentioned in the existing function
Nice, the only thing left is a changelog entry. When doing a release of this project we compile all files located in this folder. You can copy one as an example, change it to represent what is being fixed in this PR, and commit :) |
… github.com:perebaj/opentelemetry-collector-contrib into exporter/prometheusremotewriteexporter/exemplar-int
Hey guys @ArthurSens @dashpole, feel free to tag me in any kind of issue that you think would be interesting to solve I'm open to help and learn more about this ecosystem! 🙃 |
Co-authored-by: Evan Bradley <[email protected]>
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.
Thanks @perebaj!
…n-telemetry#36688) Co-authored-by: Evan Bradley <[email protected]>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description As we change the gofmt by gofumpt -> #36471, the rewrite rule that is responsible for change `interface{}` by `any` isn't working anymore. We noticed this problem here -> #36688 (comment). This PR tries to address this lack.
…n-telemetry#36688) Co-authored-by: Evan Bradley <[email protected]>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description As we change the gofmt by gofumpt -> open-telemetry#36471, the rewrite rule that is responsible for change `interface{}` by `any` isn't working anymore. We noticed this problem here -> open-telemetry#36688 (comment). This PR tries to address this lack.
Description
Fixing when exemplars receive values that aren't doubles
Link to tracking issue
Fixes #36657