@@ -81,7 +81,7 @@ function initializeOpenTelemetryMetrics (config) {
8181}
8282
8383/**
84- * @param {Record<string, unknown> } [ tags]
84+ * @param {Record<string, unknown> } tags
8585 * @param {object } [options]
8686 * @param {boolean } [options.reportHostname]
8787 * @param {string } [options.service]
@@ -100,20 +100,18 @@ function buildResourceAttributes (tags, { reportHostname, service, env, serviceV
100100 if ( env ) attrs [ 'deployment.environment.name' ] = env
101101 if ( reportHostname ) attrs [ 'host.name' ] = os . hostname ( )
102102
103- if ( tags ?. [ 'runtime-id' ] ) attrs [ 'datadog.runtime_id' ] = tags [ 'runtime-id' ]
104- if ( tags ) {
105- const tracerTags = [ ]
106- for ( const [ key , value ] of Object . entries ( tags ) ) {
107- const valueType = typeof value
108- const supported = valueType === 'string' || valueType === 'boolean' ||
109- ( valueType === 'number' && Number . isFinite ( value ) )
110- if ( ! RESERVED_TRACER_TAGS . has ( key ) && supported ) tracerTags . push ( `${ key } :${ value } ` )
111- }
112- if ( tracerTags . length ) attrs [ 'datadog.tracer_tags' ] = tracerTags
103+ if ( tags [ 'runtime-id' ] ) attrs [ 'datadog.runtime_id' ] = tags [ 'runtime-id' ]
104+ const tracerTags = [ ]
105+ for ( const [ key , value ] of Object . entries ( tags ) ) {
106+ const valueType = typeof value
107+ const supported = valueType === 'string' || valueType === 'boolean' ||
108+ ( valueType === 'number' && Number . isFinite ( value ) )
109+ if ( ! RESERVED_TRACER_TAGS . has ( key ) && supported ) tracerTags . push ( `${ key } :${ value } ` )
113110 }
111+ if ( tracerTags . length ) attrs [ 'datadog.tracer_tags' ] = tracerTags
114112 // Mirrors the legacy v0.6/stats ProcessTags shape (buildProcessTags().tagsArray); keep both in sync.
115113 const processTagsArray = processTags . tagsArray
116- if ( processTagsArray ? .length ) {
114+ if ( processTagsArray . length ) {
117115 attrs [ 'datadog.process_tags' ] = processTagsArray
118116 }
119117 return attrs
0 commit comments