Skip to content

Commit 50a0696

Browse files
Fix MetricStreamIdentity IsLongType check to include other types that should be considered as a long (aka non-floating point numbers)
1 parent 044ac44 commit 50a0696

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tracer/src/Datadog.Trace/OTelMetrics/MetricStreamIdentity.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ public MetricStreamIdentity(Instrument instrument, InstrumentType instrumentType
3535
InstrumentType = instrumentType;
3636
IsHistogram = instrumentType == InstrumentType.Histogram;
3737

38-
IsLongType = instrument.GetType().IsGenericType &&
39-
instrument.GetType().GetGenericArguments()[0] == typeof(long);
38+
Type? instrumentGenericType = instrument.GetType().IsGenericType ? instrument.GetType().GetGenericArguments()[0] : null;
39+
IsLongType = instrumentGenericType == typeof(long) ||
40+
instrumentGenericType == typeof(int) ||
41+
instrumentGenericType == typeof(short) ||
42+
instrumentGenericType == typeof(byte);
4043

4144
MetricStreamName = $"{MeterName}.{InstrumentName}.{InstrumentType}.{Unit}.{Description}";
4245
}

0 commit comments

Comments
 (0)