diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index a199243a46e..97376f4c7fb 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* Increased the character limit of the Meter instrument name from 63 to 255. + ([#4774](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4774)) + ## 1.6.0-rc.1 Released 2023-Aug-21 diff --git a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderSdk.cs b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderSdk.cs index 9ee5b71b7ab..32e09691771 100644 --- a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderSdk.cs +++ b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderSdk.cs @@ -48,7 +48,7 @@ public MeterProviderBuilderSdk(IServiceProvider serviceProvider) // Customers: This is not guaranteed to work forever. We may change this // mechanism in the future do this at your own risk. public static Regex InstrumentNameRegex { get; set; } = new( - @"^[a-z][a-z0-9-._]{0,62}$", RegexOptions.IgnoreCase | RegexOptions.Compiled); + @"^[a-z][a-z0-9-._]{0,254}$", RegexOptions.IgnoreCase | RegexOptions.Compiled); public List Instrumentation { get; } = new(); diff --git a/test/OpenTelemetry.Tests/Metrics/MetricTestData.cs b/test/OpenTelemetry.Tests/Metrics/MetricTestData.cs index afb17168826..a4614778597 100644 --- a/test/OpenTelemetry.Tests/Metrics/MetricTestData.cs +++ b/test/OpenTelemetry.Tests/Metrics/MetricTestData.cs @@ -25,7 +25,7 @@ public static IEnumerable InvalidInstrumentNames new object[] { "-first-char-not-alphabetic" }, new object[] { "1first-char-not-alphabetic" }, new object[] { "invalid+separator" }, - new object[] { new string('m', 64) }, + new object[] { new string('m', 256) }, new object[] { "a\xb5" }, // `\xb5` is the Micro character }; @@ -37,7 +37,7 @@ public static IEnumerable ValidInstrumentNames new object[] { "my-2-instrument" }, new object[] { "my.metric" }, new object[] { "my_metric2" }, - new object[] { new string('m', 63) }, + new object[] { new string('m', 255) }, new object[] { "CaSe-InSeNsItIvE" }, };