Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wconti27 committed Oct 25, 2024
1 parent fdee4b7 commit 6d8d242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
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 @@ -26,10 +26,9 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
})
if (this.config.dsmEnabled && message?.attributes) {
const payloadSize = getMessageSize(message)
const topicName = topic.split('/').pop()
this.tracer.decodeDataStreamsContext(message.attributes)
this.tracer
.setCheckpoint(['direction:in', `topic:${topicName}`, 'type:pub/sub'], span, payloadSize)
.setCheckpoint(['direction:in', `topic:${topic}`, 'type:google-pubsub'], span, payloadSize)
}
}

Expand Down
3 changes: 1 addition & 2 deletions packages/datadog-plugin-google-cloud-pubsub/src/producer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
this.tracer.inject(span, 'text_map', msg.attributes)
if (this.config.dsmEnabled) {
const payloadSize = getHeadersSize(msg)
const topicName = topic.split('/').pop()
const dataStreamsContext = this.tracer
.setCheckpoint(['direction:out', `topic:${topicName}`, 'type:pub/sub'], span, payloadSize)
.setCheckpoint(['direction:out', `topic:${topic}`, 'type:google-pubsub'], span, payloadSize)
DsmPathwayCodec.encode(dataStreamsContext, msg.attributes)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ const { ENTRY_PARENT_HASH, DataStreamsProcessor } = require('../../dd-trace/src/
// The roundtrip to the pubsub emulator takes time. Sometimes a *long* time.
const TIMEOUT = 30000

const dsmFullTopic = 'projects/test-project-42764574591eb894/topics/dsm-topic'
const dsmTopicName = 'dsm-topic'
const expectedProducerHash = computePathwayHash(
'test',
'tester',
['direction:out', 'topic:' + dsmTopicName, 'type:pub/sub'],
['direction:out', 'topic:' + dsmFullTopic, 'type:google-pubsub'],
ENTRY_PARENT_HASH
)
const expectedConsumerHash = computePathwayHash(
'test',
'tester',
['direction:in', 'topic:' + dsmTopicName, 'type:pub/sub'],
['direction:in', 'topic:' + dsmFullTopic, 'type:google-pubsub'],
expectedProducerHash
)

Expand Down

0 comments on commit 6d8d242

Please sign in to comment.