-
Notifications
You must be signed in to change notification settings - Fork 772
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 UpDownCounter and ObservableUpDownCounter #3606
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3606 +/- ##
==========================================
- Coverage 87.33% 87.29% -0.05%
==========================================
Files 280 280
Lines 10066 10081 +15
==========================================
+ Hits 8791 8800 +9
- Misses 1275 1281 +6
|
test/OpenTelemetry.Exporter.Prometheus.Tests/PrometheusSerializerTests.cs
Outdated
Show resolved
Hide resolved
exportedItems.Clear(); | ||
|
||
#if NETFRAMEWORK | ||
Thread.Sleep(5000); // Compensates for low resolution timing in netfx. |
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.
Curious, why 5000
(this is a very long time from the CPU's perspective)?
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.
CPUs always want things right now! They oughta learn to have some patience.
But, yea you're right... I decreased it to 10 ms and also decreased it from the test I borrowed this from.
@@ -25,7 +25,7 @@ internal static partial class PrometheusSerializer | |||
{ | |||
private static readonly string[] MetricTypes = new string[] | |||
{ | |||
"untyped", "counter", "gauge", "summary", "histogram", "histogram", "histogram", "histogram", "untyped", | |||
"untyped", "counter", "gauge", "summary", "histogram", "histogram", "histogram", "histogram", "gauge", |
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.
TODO: it might be good add a comment here to explain why. (like UpDownCounters are exported as Prometheus Gauge etc.)
var attributes = ToAttributes(keysValues).ToArray(); | ||
if (longValue.HasValue) | ||
{ | ||
var counter = meter.CreateUpDownCounter<long>(name, unit, description); |
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.
nit: var counterUpDownCounter
[Theory] | ||
[InlineData(true)] | ||
[InlineData(false)] | ||
public void ObservableUpDownCounterWithTagsAggregationTest(bool exportDelta) |
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.
TODO: why UpDownCounterWithTagsAggregationTest is missing?
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! we finally get updowncounter yay!
Left couple of nits, mostly about adding some code comments. Will merge.
Support for aggregating measurements from UpDownCounters. Includes updates to OTLP and Prometheus exporters.