Limit character set according to spec (#3821)
This commit is contained in:
parent
9b372023a9
commit
1a65aec968
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
* Fix instrument naming enforcement implementation to match the spec.
|
||||
([#3821](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3821))
|
||||
|
||||
* Added support for loading environment variables from `IConfiguration` when
|
||||
using the `MetricReaderOptions` & `BatchExportActivityProcessorOptions`
|
||||
classes.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace OpenTelemetry.Metrics
|
|||
internal sealed class MeterProviderBuilderSdk : MeterProviderBuilderBase
|
||||
{
|
||||
private static readonly Regex InstrumentNameRegex = new(
|
||||
@"^[a-zA-Z][-.\w]{0,62}$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
@"^[a-z][a-z0-9-._]{0,62}$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
public MeterProviderBuilderSdk()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ namespace OpenTelemetry.Metrics.Tests
|
|||
new object[] { "1first-char-not-alphabetic" },
|
||||
new object[] { "invalid+separator" },
|
||||
new object[] { new string('m', 64) },
|
||||
new object[] { "a\xb5" }, // `\xb5` is the Micro character
|
||||
};
|
||||
|
||||
public static IEnumerable<object[]> ValidInstrumentNames
|
||||
|
|
@ -39,6 +40,7 @@ namespace OpenTelemetry.Metrics.Tests
|
|||
new object[] { "my.metric" },
|
||||
new object[] { "my_metric2" },
|
||||
new object[] { new string('m', 63) },
|
||||
new object[] { "CaSe-InSeNsItIvE" },
|
||||
};
|
||||
|
||||
public static IEnumerable<object[]> InvalidHistogramBoundaries
|
||||
|
|
|
|||
Loading…
Reference in New Issue