-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Support Metrics UpDownCounter instrument #63648
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
Labels
Milestone
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
10 tasks
namespace System.Diagnostics.Metrics
{
public sealed class UpDownCounter<T> : Instrument<T> where T : struct
{
public void Add(T delta);
public void Add(T delta, KeyValuePair<string, object?> tag);
public void Add(T delta, KeyValuePair<string, object?> tag1, KeyValuePair<string, object?> tag2);
public void Add(T delta, KeyValuePair<string, object?> tag1, KeyValuePair<string, object?> tag2, KeyValuePair<string, object?> tag3);
public void Add(T delta, ReadOnlySpan<KeyValuePair<string, object?>> tags);
public void Add(T delta, params KeyValuePair<string, object?>[] tags);
public void Add(T delta, in TagList tagList);
}
public sealed class ObservableUpDownCounter<T> : ObservableInstrument<T> where T : struct
{
protected override IEnumerable<Measurement<T>> Observe();
}
public partial class Meter : IDisposable
{
public UpDownCounter<T> CreateUpDownCounter<T>(string name, string? unit = null, string? description = null) where T : struct ;
public ObservableUpDownCounter<T> CreateObservableUpDownCounter<T>(
string name,
Func<T> observeValue,
string? unit = null,
string? description = null) where T : struct;
public ObservableUpDownCounter<T> CreateObservableUpDownCounter<T>(
string name,
Func<Measurement<T>> observeValue,
string? unit = null,
string? description = null) where T : struct;
public ObservableUpDownCounter<T> CreateObservableUpDownCounter<T>(
string name,
Func<IEnumerable<Measurement<T>>> observeValues,
string? unit = null,
string? description = null) where T : struct;
}
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Background and motivation
In .NET 6.0 we have exposed the Metric APIs with exposing different instrument types
Counter
,Histogram
,ObservableCounter
, andObservableGauge
. We didn't expose the remaining instrumentsUpDownCounter
andObservableUpDownCounter
. We were collecting feedback to see the demand and the scenarios needed for such instruments before exposing it. Also, we were waiting to have OpenTelemetry specs marked as stable too.Now we have the feedback, and we are seeing the demand for such instruments and the scenarios need such instruments. The proposal here is to expose these instruments.
OpenTelemetry specification
open-telemetry/opentelemetry-dotnet#2362
APIs Proposal
UpDownCounter and ObservableUpDownCounter support only the following generic parameter types:
Byte
,Int16
,Int32
,Int64
,Single
,Double
, andDecimal
.APIs Usage
The text was updated successfully, but these errors were encountered: