Skip to content
Merged
6 changes: 2 additions & 4 deletions packages/datadog-plugin-google-cloud-pubsub/src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
const meta = {
'gcloud.project_id': subscription.pubsub.projectId,
'pubsub.topic': topic,
'pubsub.message_id': message.messageId,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use pull message id field instead of messageId

For pull subscriptions, the Pub/Sub Message object exposes the server-assigned ID as message.id (this was what the code used before). Switching the tag to message.messageId means the tag will be undefined for standard pull messages, so pubsub.message_id stops being recorded and downstream correlation/debugging based on message ID is lost. This regression only affects pull subscriptions where the Message instance does not include a messageId alias.

Useful? React with 👍 / 👎.

'span.kind': 'consumer',
'pubsub.subscription': subscription.name,
'pubsub.subscription_type': 'pull',
'pubsub.span_type': 'message_processing',
'messaging.operation': 'receive',
base_service: baseService,
service_override_type: 'custom',
Expand Down Expand Up @@ -171,9 +172,6 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
metrics,
}, ctx)

if (message.id) {
span.setTag('pubsub.message_id', message.id)
}
if (message.publishTime) {
span.setTag('pubsub.publish_time', message.publishTime.toISOString())
}
Expand Down
Loading