forked from open-telemetry/opentelemetry-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetricTestData.cs
61 lines (54 loc) · 2.28 KB
/
MetricTestData.cs
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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
using Xunit;
namespace OpenTelemetry.Metrics.Tests;
public class MetricTestData
{
public static TheoryData<string> InvalidInstrumentNames
=>
[
" ",
"-first-char-not-alphabetic",
"1first-char-not-alphabetic",
"invalid+separator",
new('m', 256),
"a\xb5", // `\xb5` is the Micro character
];
public static TheoryData<string> ValidInstrumentNames
=>
[
"m",
"first-char-alphabetic",
"my-2-instrument",
"my.metric",
"my_metric2",
new('m', 255),
"CaSe-InSeNsItIvE",
"my_metric/environment/database",
];
public static TheoryData<double[]> InvalidHistogramBoundaries
=>
[
[0.0, 0.0],
[1.0, 0.0],
[0.0, 1.0, 1.0, 2.0],
[0.0, 1.0, 2.0, -1.0],
];
public static TheoryData<double[], HistogramConfiguration, double, double> ValidHistogramMinMax =>
new()
{
{ [-10.0, 0.0, 1.0, 9.0, 10.0, 11.0, 19.0], new HistogramConfiguration(), -10.0, 19.0 },
{ [double.NegativeInfinity], new HistogramConfiguration(), double.NegativeInfinity, double.NegativeInfinity },
{ [double.NegativeInfinity, 0.0, double.PositiveInfinity], new HistogramConfiguration(), double.NegativeInfinity, double.PositiveInfinity },
{ [1.0], new HistogramConfiguration(), 1.0, 1.0 },
{ [5.0, 100.0, 4.0, 101.0, -2.0, 97.0], new ExplicitBucketHistogramConfiguration { Boundaries = [10.0, 20.0] }, -2.0, 101.0 },
{ [5.0, 100.0, 4.0, 101.0, -2.0, 97.0], new Base2ExponentialBucketHistogramConfiguration(), 4.0, 101.0 },
};
public static TheoryData<double[], HistogramConfiguration> InvalidHistogramMinMax
=> new()
{
{ [1.0], new HistogramConfiguration { RecordMinMax = false } },
{ [1.0], new ExplicitBucketHistogramConfiguration { Boundaries = [10.0, 20.0], RecordMinMax = false } },
{ [1.0], new Base2ExponentialBucketHistogramConfiguration { RecordMinMax = false } },
};
}