-
Notifications
You must be signed in to change notification settings - Fork 790
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
Update Metric Point for Counter and Gauge #2667
Update Metric Point for Counter and Gauge #2667
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2667 +/- ##
==========================================
- Coverage 82.92% 82.88% -0.05%
==========================================
Files 249 249
Lines 8691 8705 +14
==========================================
+ Hits 7207 7215 +8
- Misses 1484 1490 +6
|
} | ||
} | ||
|
||
public long GetLastLongValue() |
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.
public long GetLastLongValue() | |
public long GetLastValueLong() |
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.
Is "last value" something meaningful from the spec? If not something like GetGaugeValueLong
might be more clear.
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.
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.
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.
Basically, Gauge in OpenTelemetry is a stream of metric points, and each point is a combination of {last value, timestamps, attributes, exemplars}.
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.
We do have some helper methods with "Histogram" in the name (at least currently), what if we added a type in all the names? Something like...
GetCounterSumAsLong, GetCounterSumAsDouble, GetGaugeLastValueAsLong, GetGaugeLastValueAsDouble
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 like this, except the "As" in the name which indicates we are doing some cast..
GetCounterSumLong
and friends, sounds better to me.
|
||
internal MetricPointStatus MetricPointStatus { get; private set; } | ||
public double GetDoubleSum() |
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.
public double GetDoubleSum() | |
public double GetSumDouble() |
^ thoughts?
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.
GetSum<double>
😆 (return value sucks)
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.
To me GetDoubleSum
reads better than GetSumDouble
.
But: below I think it makes sense to call GetLastValueLong
as others suggested. So.. now I'm in doubt on this one. It would be kinda inconsistent then if we go with GetDoubleSum
, no? 🤔
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.
@joaopgrassi #2667 (comment) we currently settled with this. Please let us know what do you think.
|
||
internal MetricPointStatus MetricPointStatus { get; private set; } | ||
public double GetDoubleSum() |
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.
To me GetDoubleSum
reads better than GetSumDouble
.
But: below I think it makes sense to call GetLastValueLong
as others suggested. So.. now I'm in doubt on this one. It would be kinda inconsistent then if we go with GetDoubleSum
, no? 🤔
cursor = WriteLong(buffer, cursor, metricPoint.GetLongSum()); | ||
} | ||
else | ||
{ |
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.
It seems we do this code in a few places now (if sum - GetLongSum..). Maybe we could use an extension method on metricPoint that accepts the MetricType
?
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.
These checks be avoided. We have a TODO in line 68 about this.
…Point-For-Counter-Gauge
…//github.com/utpilla/opentelemetry-dotnet into utpilla/Update-MetricPoint-For-Counter-Gauge
Changes
GetCounterSumLong
,GetCounterSumDouble
,GetGaugeLastValueLong
,GetGaugeLastValueDouble
,GetStartTime
, andGetEndTime
. toMetricPoint
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes