-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[pdata] Split pmetric.MetricValueType
into more specific types
#5233
Conversation
dafa37a
to
3422cf2
Compare
Codecov Report
@@ Coverage Diff @@
## main #5233 +/- ##
=======================================
Coverage 90.59% 90.60%
=======================================
Files 187 187
Lines 11052 11061 +9
=======================================
+ Hits 10013 10022 +9
Misses 820 820
Partials 219 219
Continue to review full report at Codecov.
|
e32ec39
to
66f545a
Compare
pdata/pmetric/alias.go
Outdated
// ExemplarValueType specifies the type of Exemplar measurement value. | ||
type ExemplarValueType = internal.MetricValueType | ||
|
||
const ( | ||
ExemplarValueTypeNone = internal.MetricValueTypeNone | ||
ExemplarValueTypeInt = internal.MetricValueTypeInt | ||
ExemplarValueTypeDouble = internal.MetricValueTypeDouble | ||
) |
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 this is that used, so I would propose an exception here and do the correct thing, as long as we can build successfully the contrib. Give a try :)
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.
My idea is to see if we do the right thing for exemplar (no backwards compatible change) is ok.
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.
Makes sense. We can probably break MetricValueType
-> ExemplarValueType
, but keep MetricValueType
<-> NumberDataPOintValueType
backward compatible 👍
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.
Updated PR. Looks like Exemplar types are used at in pkg/translator/opencensus/metrics_to_oc.go
I don't see any other errors
66f545a
to
ef93b99
Compare
Split `pmetric.MetricValueType` into `NumberDataPointValueType` and `ExemplarValueType` 1. `NumberDataPoint.ValueType()` now returns a `NumberDataPointValueType` that can be `NumberDataPointValueTypeInt` or `NumberDataPointValueTypeDouble`. 2. `pmetric.Exemplar.ValueType()` now returns a `ExemplarValueType` that can be `ExemplarValueInt` or `ExemplarValueDouble`. 1 Use case is the most common. Thats why we are keeping backward compatibility for it. 2 is rarely being used. So we don't keep backward compatibility for it to avoid mixing the split types.
ef93b99
to
31b6e75
Compare
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 am ok with the exception for the ExemplarValueType
.
SGMT, please check the contrib codebase for usage too and if it is very rarely used then I am fine with this approach. |
Split
pmetric.MetricValueType
intoNumberDataPointValueType
andExemplarValueType
pmetric.NumberDataPoint.ValueType()
now returns aNumberDataPointValueType
that can beNumberDataPointValueTypeInt
orNumberDataPointValueTypeDouble
.pmetric.Exemplar.ValueType()
now returns aExemplarValueType
that can beExemplarValueInt
orExemplarValueDouble
.(1) use case is most commonly being used. Thats why we keep backward compatibility for it. We don't keep backward compatibility for (2) it to avoid mixing the split types.
Closes: #4819
Replaces #5227