File tree 2 files changed +8
-1
lines changed
experimental/packages/opentelemetry-sdk-metrics-base
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,6 @@ export class Meter implements api.Meter {
350
350
* @param name Name of metric to be created
351
351
*/
352
352
private _isValidName ( name : string ) : boolean {
353
- return Boolean ( name . match ( / ^ [ a - z ] [ a - z 0 - 9 _ . - ] * $ / i) ) ;
353
+ return Boolean ( name . match ( / ^ [ a - z ] [ a - z 0 - 9 _ . - ] { 0 , 62 } $ / i) ) ;
354
354
}
355
355
}
Original file line number Diff line number Diff line change @@ -295,6 +295,13 @@ describe('Meter', () => {
295
295
const counter = meter . createCounter ( 'name with invalid characters^&*(' ) ;
296
296
assert . ok ( counter instanceof api . NoopMetric ) ;
297
297
} ) ;
298
+
299
+ it ( 'should return no op metric if name exceeded length of 63' , ( ) => {
300
+ const counter = meter . createCounter ( 'a' . repeat ( 63 ) ) ;
301
+ assert . ok ( counter instanceof CounterMetric ) ;
302
+ const counter2 = meter . createCounter ( 'a' . repeat ( 64 ) ) ;
303
+ assert . ok ( counter2 instanceof api . NoopMetric ) ;
304
+ } ) ;
298
305
} ) ;
299
306
} ) ;
300
307
You can’t perform that action at this time.
0 commit comments