File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -437,11 +437,6 @@ class Metrics extends Utility implements MetricsInterface {
437
437
if ( ! this . getColdStart ( ) ) return ;
438
438
const singleMetric = this . singleMetric ( ) ;
439
439
440
- if ( this . defaultDimensions . service ) {
441
- singleMetric . setDefaultDimensions ( {
442
- service : this . defaultDimensions . service ,
443
- } ) ;
444
- }
445
440
const value = this . functionName ?. trim ( ) ?? functionName ?. trim ( ) ;
446
441
if ( value && value . length > 0 ) {
447
442
singleMetric . addDimension ( 'function_name' , value ) ;
@@ -846,9 +841,14 @@ class Metrics extends Utility implements MetricsInterface {
846
841
}
847
842
848
843
if ( Object . hasOwn ( this . defaultDimensions , key ) ) {
849
- this . #logger. warn (
850
- `Dimension "${ key } " has already been added. The previous value will be overwritten.`
851
- ) ;
844
+ const currentValue = this . defaultDimensions [ key ] ;
845
+ const suppressOverwriteWarning =
846
+ key === 'service' && currentValue === this . defaultServiceName ;
847
+ if ( ! suppressOverwriteWarning ) {
848
+ this . #logger. warn (
849
+ `Dimension "${ key } " has already been added. The previous value will be overwritten.`
850
+ ) ;
851
+ }
852
852
}
853
853
854
854
cleanedDimensions [ key ] = value ;
You can’t perform that action at this time.
0 commit comments