forked from open-telemetry/opentelemetry-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExemplarMeasurement.cs
More file actions
62 lines (55 loc) · 1.81 KB
/
ExemplarMeasurement.cs
File metadata and controls
62 lines (55 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
using OpenTelemetry.Internal;
#endif
namespace OpenTelemetry.Metrics;
#if EXPOSE_EXPERIMENTAL_FEATURES
/// <summary>
/// Represents an Exemplar measurement.
/// </summary>
/// <remarks><inheritdoc cref="ExemplarReservoir" path="/remarks/para[@experimental-warning='true']"/></remarks>
/// <typeparam name="T">Measurement type.</typeparam>
#if NET8_0_OR_GREATER
[Experimental(DiagnosticDefinitions.ExemplarReservoirExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
internal
#endif
readonly ref struct ExemplarMeasurement<T>
where T : struct
{
internal ExemplarMeasurement(
T value,
ReadOnlySpan<KeyValuePair<string, object?>> tags)
{
this.Value = value;
this.Tags = tags;
this.ExplicitBucketHistogramBucketIndex = -1;
}
internal ExemplarMeasurement(
T value,
ReadOnlySpan<KeyValuePair<string, object?>> tags,
int explicitBucketHistogramIndex)
{
this.Value = value;
this.Tags = tags;
this.ExplicitBucketHistogramBucketIndex = explicitBucketHistogramIndex;
}
/// <summary>
/// Gets the measurement value.
/// </summary>
public T Value { get; }
/// <summary>
/// Gets the measurement tags.
/// </summary>
/// <remarks>
/// Note: <see cref="Tags"/> represents the full set of tags supplied at
/// measurement regardless of any filtering configured by a view (<see
/// cref="MetricStreamConfiguration.TagKeys"/>).
/// </remarks>
public ReadOnlySpan<KeyValuePair<string, object?>> Tags { get; }
internal int ExplicitBucketHistogramBucketIndex { get; }
}