Skip to content

Commit

Permalink
docs: update custom gcp attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
feywind committed Nov 30, 2023
1 parent 0d64d90 commit 97d6bef
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/telemetry-tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ export class PubsubSpans {
] = message.data?.length;
}
if (message.orderingKey) {
spanAttributes['messaging.pubsub.ordering_key'] = message.orderingKey;
spanAttributes['messaging.gcp.pubsub.ordering_key'] =
message.orderingKey;
}
}

Expand Down Expand Up @@ -334,18 +335,18 @@ export class PubsubSpans {
ROOT_CONTEXT
);
span?.setAttribute(
'messaging.pubsub.num_messages_in_batch',
'messaging.gcp.pubsub.num_messages_in_batch',
messages.length
);
messages.forEach(m => {
// Workaround until the JS API properly supports adding links later.
if (m.parentSpan) {
m.parentSpan.setAttribute(
'gcp_pubsub.publish.trace_id',
'messaging.gcp.pubsub.publish.trace_id',
span.spanContext().traceId
);
m.parentSpan.setAttribute(
'gcp_pubsub.publish.span_id',
'messaging.gcp.pubsub.publish.span_id',
span.spanContext().spanId
);
}
Expand Down Expand Up @@ -374,7 +375,7 @@ export class PubsubSpans {
}

static setReceiveProcessResult(span: Span, isAck: boolean) {
span.setAttribute('messaging.pubsub.result', isAck ? 'ack' : 'nack');
span.setAttribute('messaging.gcp.pubsub.result', isAck ? 'ack' : 'nack');
}

static createReceiveLeaseSpan(
Expand All @@ -384,10 +385,10 @@ export class PubsubSpans {
): Span | undefined {
const span = PubsubSpans.createChildSpan('modify ack deadline', message);
span?.setAttribute(
'messaging.pubsub.modack_deadline_seconds',
'messaging.gcp.pubsub.modack_deadline_seconds',
deadline.totalOf('second')
);
span?.setAttribute('messaging.pubsub.is_receipt_modack', isInitial);
span?.setAttribute('messaging.gcp.pubsub.is_receipt_modack', isInitial);
return span;
}
}
Expand Down Expand Up @@ -439,10 +440,10 @@ export class PubsubEvents {
isInitial: boolean
) {
PubsubEvents.addEvent('modify ack deadline start', message, {
'messaging.pubsub.modack_deadline_seconds': `${deadline.totalOf(
'messaging.gcp.pubsub.modack_deadline_seconds': `${deadline.totalOf(
'second'
)}`,
'messaging.pubsub.is_receipt_modack': isInitial ? 'true' : 'false',
'messaging.gcp.pubsub.is_receipt_modack': isInitial ? 'true' : 'false',
});
}

Expand Down

0 comments on commit 97d6bef

Please sign in to comment.