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
Support bool metrics #637
Support bool metrics #637
Conversation
Codecov Report
@@ Coverage Diff @@
## main #637 +/- ##
==========================================
+ Coverage 66.44% 68.39% +1.95%
==========================================
Files 36 36
Lines 4297 4559 +262
==========================================
+ Hits 2855 3118 +263
+ Misses 1314 1288 -26
- Partials 128 153 +25
... and 8 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
1ec3cea
to
159eb6f
Compare
Can you add a fixture based integration test for this? It should make it really easy to test your changes against the real API as well. Directions in https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/main/exporter/collector/integrationtests.md |
159eb6f
to
f9b6474
Compare
The keys are removed from labelDescriptors and metricLabels so as to prevent creation of separate time-series data for distinct values for those labels.
This reverts commit 1c68822.
beef212
to
777a342
Compare
exporter/collector/integrationtest/testdata/fixtures/metrics/boolean_gauge_metrics.json
Show resolved
Hide resolved
exporter/collector/metrics.go
Outdated
_, supportedType := me.convertMetricKindToBoolIfSupported(m.Gauge().DataPoints().At(0), kind, m.Unit()) | ||
if supportedType != metricpb.MetricDescriptor_VALUE_TYPE_UNSPECIFIED { | ||
typ = supportedType | ||
} else { | ||
typ = metricPointValueType(m.Gauge().DataPoints().At(0).ValueType()) | ||
} |
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.
would it make sense to move the same kind of check that convertMetricKindToBoolIfSupported
does into metricPointValueType
? so then the switch statement would be something like:
switch pt {
case pmetric.NumberDataPointValueTypeInt:
if boolUnitPresent && metricKind == metricpb.MetricDescriptor_GAUGE {
return metricpb.MetricDescriptor_BOOL
}
return metricpb.MetricDescriptor_INT64
}
you could add a similar error log but it's already going to be covered by the actual data point conversion
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.
But then we would have to pass all those extra parameters - kind and and unit to metricPointValueType
as well.
Currently this method seems simple to me and serves a single purpose - convert pmetric.NumberDataPointValueType
to its equivalent cloud monitoring type. I can see it going either way if you feel strongly about this.
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.
Just removed the support for Bool metrics from non-monotonic sum (which was interpreted as GUAGE) as per the spec we have.
So now moving the check to metricPointValueType
would only simplify switch statement for a single case and I feel it may not increase readability by a lot.
Co-authored-by: Mike Dame <mikedame@google.com>
4b02365
to
5f8812c
Compare
5f8812c
to
caa5345
Compare
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
e5cd54d
to
626a0e4
Compare
b113932
to
4331895
Compare
PR to add support for Bool metrics in exporter/collector.
This currently adds support for boolean valued metrics in collector exporter.
Testing
#624