Skip to content

Commit 9976b38

Browse files
authored
Merge 71bc38d into 1a8652a
2 parents 1a8652a + 71bc38d commit 9976b38

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
1313

1414
### :bug: (Bug Fix)
1515

16+
* fix(sdk-metrics): allow instrument names to contain '/' [#4155](https://github.com/open-telemetry/opentelemetry-js/pull/4155)
17+
1618
### :books: (Refine Doc)
1719

1820
### :house: (Internal)

packages/sdk-metrics/src/InstrumentDescriptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function isDescriptorCompatibleWith(
8888

8989
// ASCII string with a length no greater than 255 characters.
9090
// NB: the first character counted separately from the rest.
91-
const NAME_REGEXP = /^[a-z][a-z0-9_.-]{0,254}$/i;
91+
const NAME_REGEXP = /^[a-z][a-z0-9_.\-/]{0,254}$/i;
9292
export function isValidName(name: string): boolean {
9393
return name.match(NAME_REGEXP) != null;
9494
}

packages/sdk-metrics/test/util.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ export const defaultInstrumentationScope: InstrumentationScope = {
6767
};
6868

6969
export const invalidNames = ['', 'a'.repeat(256), '1a', '-a', '.a', '_a'];
70-
export const validNames = ['a', 'a'.repeat(255), 'a1', 'a-1', 'a.1', 'a_1'];
70+
export const validNames = [
71+
'a',
72+
'a'.repeat(255),
73+
'a1',
74+
'a-1',
75+
'a.1',
76+
'a_1',
77+
'a/1',
78+
];
7179

7280
export const commonValues: number[] = [1, -1, 1.0, Infinity, -Infinity, NaN];
7381
export const commonAttributes: MetricAttributes[] = [

0 commit comments

Comments
 (0)