diff --git a/src/OpenTelemetry/Metrics/DataPoint/Exemplar.cs b/src/OpenTelemetry/Metrics/DataPoint/Exemplar.cs index 4fba9dd4700..7b9798d3fc2 100644 --- a/src/OpenTelemetry/Metrics/DataPoint/Exemplar.cs +++ b/src/OpenTelemetry/Metrics/DataPoint/Exemplar.cs @@ -16,17 +16,17 @@ using System; using System.Collections.Generic; +using System.Diagnostics; namespace OpenTelemetry.Metrics { internal readonly struct Exemplar : IExemplar { private static readonly KeyValuePair[] EmptyTag = new KeyValuePair[0]; - private static readonly byte[] EmptyId = new byte[0]; private readonly IDataValue value; - internal Exemplar(DateTimeOffset timestamp, long value, byte[] spanId, byte[] traceId, KeyValuePair[] filteredTags) + internal Exemplar(DateTimeOffset timestamp, long value, ActivityTraceId traceId, ActivitySpanId spanId, KeyValuePair[] filteredTags) { this.Timestamp = timestamp; this.FilteredTags = filteredTags; @@ -35,7 +35,7 @@ internal Exemplar(DateTimeOffset timestamp, long value, byte[] spanId, byte[] tr this.value = new DataValue(value); } - internal Exemplar(DateTimeOffset timestamp, double value, byte[] spanId, byte[] traceId, KeyValuePair[] filteredTags) + internal Exemplar(DateTimeOffset timestamp, double value, ActivityTraceId traceId, ActivitySpanId spanId, KeyValuePair[] filteredTags) { this.Timestamp = timestamp; this.FilteredTags = filteredTags; @@ -44,7 +44,7 @@ internal Exemplar(DateTimeOffset timestamp, double value, byte[] spanId, byte[] this.value = new DataValue(value); } - internal Exemplar(DateTimeOffset timestamp, IDataValue value, byte[] spanId, byte[] traceId, KeyValuePair[] filteredTags) + internal Exemplar(DateTimeOffset timestamp, IDataValue value, ActivityTraceId traceId, ActivitySpanId spanId, KeyValuePair[] filteredTags) { this.Timestamp = timestamp; this.FilteredTags = filteredTags; @@ -54,17 +54,17 @@ internal Exemplar(DateTimeOffset timestamp, IDataValue value, byte[] spanId, byt } internal Exemplar(DateTimeOffset timestamp, long value) - : this(timestamp, value, Exemplar.EmptyId, Exemplar.EmptyId, Exemplar.EmptyTag) + : this(timestamp, value, default, default, Exemplar.EmptyTag) { } internal Exemplar(DateTimeOffset timestamp, double value) - : this(timestamp, value, Exemplar.EmptyId, Exemplar.EmptyId, Exemplar.EmptyTag) + : this(timestamp, value, default, default, Exemplar.EmptyTag) { } internal Exemplar(DateTimeOffset timestamp, IDataValue value) - : this(timestamp, value, Exemplar.EmptyId, Exemplar.EmptyId, Exemplar.EmptyTag) + : this(timestamp, value, default, default, Exemplar.EmptyTag) { } @@ -72,9 +72,9 @@ internal Exemplar(DateTimeOffset timestamp, IDataValue value) public readonly KeyValuePair[] FilteredTags { get; } - public readonly byte[] SpanId { get; } + public readonly ActivityTraceId TraceId { get; } - public readonly byte[] TraceId { get; } + public readonly ActivitySpanId SpanId { get; } public object Value => this.value.Value; } diff --git a/src/OpenTelemetry/Metrics/DataPoint/Exemplar{T}.cs b/src/OpenTelemetry/Metrics/DataPoint/Exemplar{T}.cs index 000e7bce7d9..140e0f799c9 100644 --- a/src/OpenTelemetry/Metrics/DataPoint/Exemplar{T}.cs +++ b/src/OpenTelemetry/Metrics/DataPoint/Exemplar{T}.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; namespace OpenTelemetry.Metrics { @@ -23,11 +24,10 @@ namespace OpenTelemetry.Metrics where T : struct { private static readonly KeyValuePair[] EmptyTag = new KeyValuePair[0]; - private static readonly byte[] EmptyId = new byte[0]; private readonly IDataValue value; - internal Exemplar(DateTimeOffset timestamp, T value, byte[] spanId, byte[] traceId, KeyValuePair[] filteredTags) + internal Exemplar(DateTimeOffset timestamp, T value, ActivityTraceId traceId, ActivitySpanId spanId, KeyValuePair[] filteredTags) { this.Timestamp = timestamp; this.FilteredTags = filteredTags; @@ -36,7 +36,7 @@ internal Exemplar(DateTimeOffset timestamp, T value, byte[] spanId, byte[] trace this.value = new DataValue(value); } - internal Exemplar(DateTimeOffset timestamp, IDataValue value, byte[] spanId, byte[] traceId, KeyValuePair[] filteredTags) + internal Exemplar(DateTimeOffset timestamp, IDataValue value, ActivityTraceId traceId, ActivitySpanId spanId, KeyValuePair[] filteredTags) { this.Timestamp = timestamp; this.FilteredTags = filteredTags; @@ -46,12 +46,12 @@ internal Exemplar(DateTimeOffset timestamp, IDataValue value, byte[] spanId, byt } internal Exemplar(DateTimeOffset timestamp, T value) - : this(timestamp, value, Exemplar.EmptyId, Exemplar.EmptyId, Exemplar.EmptyTag) + : this(timestamp, value, default, default, Exemplar.EmptyTag) { } internal Exemplar(DateTimeOffset timestamp, IDataValue value) - : this(timestamp, value, Exemplar.EmptyId, Exemplar.EmptyId, Exemplar.EmptyTag) + : this(timestamp, value, default, default, Exemplar.EmptyTag) { } @@ -59,9 +59,9 @@ internal Exemplar(DateTimeOffset timestamp, IDataValue value) public readonly KeyValuePair[] FilteredTags { get; } - public readonly byte[] SpanId { get; } + public readonly ActivityTraceId TraceId { get; } - public readonly byte[] TraceId { get; } + public readonly ActivitySpanId SpanId { get; } public object Value => this.value.Value; } diff --git a/src/OpenTelemetry/Metrics/DataPoint/IExemplar.cs b/src/OpenTelemetry/Metrics/DataPoint/IExemplar.cs index f51f9635706..96aa7eb45ac 100644 --- a/src/OpenTelemetry/Metrics/DataPoint/IExemplar.cs +++ b/src/OpenTelemetry/Metrics/DataPoint/IExemplar.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; namespace OpenTelemetry.Metrics { @@ -25,8 +26,8 @@ public interface IExemplar : IDataValue KeyValuePair[] FilteredTags { get; } - byte[] SpanId { get; } + ActivityTraceId TraceId { get; } - byte[] TraceId { get; } + ActivitySpanId SpanId { get; } } }