Skip to content

Commit

Permalink
Abstract the passing of extracted header span links to startSpan (#4918)
Browse files Browse the repository at this point in the history
* updating span links

* correcting field name

* fixing links to _links
  • Loading branch information
mhlidd authored Nov 21, 2024
1 parent d0e80ea commit 6080dfa
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 23 deletions.
3 changes: 1 addition & 2 deletions packages/datadog-plugin-amqplib/src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class AmqplibConsumerPlugin extends ConsumerPlugin {
'amqp.consumerTag': fields.consumerTag,
'amqp.source': fields.source,
'amqp.destination': fields.destination
},
extractedLinks: childOf?._links
}
})

if (
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-aws-sdk/src/services/kinesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class Kinesis extends BaseAwsSdkPlugin {
{},
this.requestTags.get(request) || {},
{ 'span.kind': 'server' }
),
extractedLinks: responseExtraction.maybeChildOf._links
)
}
span = plugin.tracer.startSpan('aws.response', options)
this.enter(span, store)
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-aws-sdk/src/services/sqs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Sqs extends BaseAwsSdkPlugin {
{},
this.requestTags.get(request) || {},
{ 'span.kind': 'server' }
),
extractedLinks: contextExtraction.datadogContext._links
)
}
parsedMessageAttributes = contextExtraction.parsedAttributes
span = plugin.tracer.startSpan('aws.response', options)
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-google-cloud-pubsub/src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
},
metrics: {
'pubsub.ack': 0
},
extractedLinks: childOf?._links
}
})
if (this.config.dsmEnabled && message?.attributes) {
const payloadSize = getMessageSize(message)
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-grpc/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class GrpcServerPlugin extends ServerPlugin {
},
metrics: {
'grpc.status.code': 0
},
extractedLinks: childOf?._links
}
})

addMetadataTags(span, metadata, metadataFilter, 'request')
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-jest/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ class JestPlugin extends CiPlugin {
[COMPONENT]: this.constructor.id,
...this.testEnvironmentMetadata,
...testSuiteMetadata
},
extractedLinks: testSessionSpanContext?._links
}
})
this.telemetry.ciVisEvent(TELEMETRY_EVENT_CREATED, 'suite')
if (_ddTestCodeCoverageEnabled) {
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-kafkajs/src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class KafkajsConsumerPlugin extends ConsumerPlugin {
},
metrics: {
'kafka.partition': partition
},
extractedLinks: childOf?._links
}
})
if (this.config.dsmEnabled && message?.headers) {
const payloadSize = getMessageSize(message)
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-moleculer/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class MoleculerServerPlugin extends ServerPlugin {
meta: {
'resource.name': action.name,
...moleculerTags(broker, ctx, this.config)
},
extractedLinks: followsFrom?._links
}
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-rhea/src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class RheaConsumerPlugin extends ConsumerPlugin {
component: 'rhea',
'amqp.link.source.address': name,
'amqp.link.role': 'receiver'
},
extractedLinks: childOf?._links
}
})

if (
Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-vitest/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ class VitestPlugin extends CiPlugin {
[COMPONENT]: this.constructor.id,
...this.testEnvironmentMetadata,
...testSuiteMetadata
},
extractedLinks: testSessionSpanContext?._links
}
})
this.telemetry.ciVisEvent(TELEMETRY_EVENT_CREATED, 'suite')
const store = storage.getStore()
Expand Down
4 changes: 2 additions & 2 deletions packages/dd-trace/src/plugins/tracing.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class TracingPlugin extends Plugin {
}
}

startSpan (name, { childOf, kind, meta, metrics, service, resource, type, extractedLinks } = {}, enter = true) {
startSpan (name, { childOf, kind, meta, metrics, service, resource, type } = {}, enter = true) {
const store = storage.getStore()
if (store && childOf === undefined) {
childOf = store.span
Expand All @@ -119,7 +119,7 @@ class TracingPlugin extends Plugin {
...metrics
},
integrationName: type,
links: extractedLinks
links: childOf?._links
})

analyticsSampler.sample(span, this.config.measured)
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/plugins/util/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const web = {
}
}

const span = tracer.startSpan(name, { childOf, extractedLinks: childOf?.links })
const span = tracer.startSpan(name, { childOf, links: childOf?._links })

return span
},
Expand Down

0 comments on commit 6080dfa

Please sign in to comment.