Skip to content

Commit cc67a0e

Browse files
committed
🔧 propagate pubsub tracing
1 parent 06ba451 commit cc67a0e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/models/pubsub/pubsub-client.model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PubSub } from '@google-cloud/pubsub';
22
import { timeout } from '../../util/timeout';
3+
import { context, propagation } from '@opentelemetry/api';
34

45
const PUBLISH_TIMEOUT = 10_000;
56

@@ -17,6 +18,8 @@ export class PubSubClient<T> {
1718
throw new Error('No pubsub topic name provided.');
1819
}
1920

21+
propagation.inject(context.active(), message);
22+
2023
const json = JSON.stringify(message);
2124
const dataBuffer = Buffer.from(json);
2225
const topic = this.client.topic(this.topicName);

0 commit comments

Comments
 (0)