Skip to content

Commit

Permalink
🔧 propagate pubsub tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonaOna committed Nov 21, 2023
1 parent 06ba451 commit cc67a0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/models/pubsub/pubsub-client.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PubSub } from '@google-cloud/pubsub';
import { timeout } from '../../util/timeout';
import { context, propagation } from '@opentelemetry/api';

const PUBLISH_TIMEOUT = 10_000;

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

propagation.inject(context.active(), message);

const json = JSON.stringify(message);
const dataBuffer = Buffer.from(json);
const topic = this.client.topic(this.topicName);
Expand Down

0 comments on commit cc67a0e

Please sign in to comment.