Skip to content

Commit

Permalink
Update MetricsConstants and MetricsHook to use long instead of double
Browse files Browse the repository at this point in the history
Signed-off-by: André Silva <[email protected]>
  • Loading branch information
askpt committed Dec 15, 2023
1 parent 4cb73a5 commit f8e52e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/OpenFeature.Contrib.Hooks.Otel/MetricsConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace OpenFeature.Contrib.Hooks.Otel
{
internal static class MetricsConstants
{
internal const string Unit = "double";
internal const string Unit = "long";

internal const string ActiveCountName = "feature_flag.evaluation_active_count";
internal const string RequestsTotalName = "feature_flag.evaluation_requests_total";
Expand Down
16 changes: 8 additions & 8 deletions src/OpenFeature.Contrib.Hooks.Otel/MetricsHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class MetricsHook : Hook
private static readonly string InstrumentationName = AssemblyName.Name;
private static readonly string InstrumentationVersion = AssemblyName.Version.ToString();

private readonly UpDownCounter<double> _evaluationActiveUpDownCounter;
private readonly Counter<double> _evaluationRequestCounter;
private readonly Counter<double> _evaluationSuccessCounter;
private readonly Counter<double> _evaluationErrorCounter;
private readonly UpDownCounter<long> _evaluationActiveUpDownCounter;
private readonly Counter<long> _evaluationRequestCounter;
private readonly Counter<long> _evaluationSuccessCounter;
private readonly Counter<long> _evaluationErrorCounter;

/// <summary>
/// Initializes a new instance of the <see cref="MetricsHook"/> class.
Expand All @@ -30,10 +30,10 @@ public MetricsHook()
{
var meter = new Meter(InstrumentationName, InstrumentationVersion);

_evaluationActiveUpDownCounter = meter.CreateUpDownCounter<double>(MetricsConstants.ActiveCountName, MetricsConstants.Unit, MetricsConstants.ActiveDescription);
_evaluationRequestCounter = meter.CreateCounter<double>(MetricsConstants.RequestsTotalName, MetricsConstants.Unit, MetricsConstants.RequestsDescription);
_evaluationSuccessCounter = meter.CreateCounter<double>(MetricsConstants.SuccessTotalName, MetricsConstants.Unit, MetricsConstants.SuccessDescription);
_evaluationErrorCounter = meter.CreateCounter<double>(MetricsConstants.ErrorTotalName, MetricsConstants.Unit, MetricsConstants.ErrorDescription);
_evaluationActiveUpDownCounter = meter.CreateUpDownCounter<long>(MetricsConstants.ActiveCountName, MetricsConstants.Unit, MetricsConstants.ActiveDescription);
_evaluationRequestCounter = meter.CreateCounter<long>(MetricsConstants.RequestsTotalName, MetricsConstants.Unit, MetricsConstants.RequestsDescription);
_evaluationSuccessCounter = meter.CreateCounter<long>(MetricsConstants.SuccessTotalName, MetricsConstants.Unit, MetricsConstants.SuccessDescription);
_evaluationErrorCounter = meter.CreateCounter<long>(MetricsConstants.ErrorTotalName, MetricsConstants.Unit, MetricsConstants.ErrorDescription);
}

/// <summary>
Expand Down

0 comments on commit f8e52e6

Please sign in to comment.