@@ -360,14 +360,11 @@ const (
360
360
resultExpired = "expired"
361
361
362
362
// custom pubsub specific attributes
363
- gcpProjectIDAttribute = "gcp.project_id"
364
- pubsubPrefix = "messaging.gcp_pubsub."
365
- orderingAttribute = pubsubPrefix + "message.ordering_key"
366
- deliveryAttemptAttribute = pubsubPrefix + "message.delivery_attempt"
367
- eosAttribute = pubsubPrefix + "exactly_once_delivery"
368
- ackIDAttribute = pubsubPrefix + "message.ack_id"
369
- resultAttribute = pubsubPrefix + "result"
370
- receiptModackAttribute = pubsubPrefix + "is_receipt_modack"
363
+ gcpProjectIDAttribute = "gcp.project_id"
364
+ pubsubPrefix = "messaging.gcp_pubsub."
365
+ eosAttribute = pubsubPrefix + "exactly_once_delivery"
366
+ resultAttribute = pubsubPrefix + "result"
367
+ receiptModackAttribute = pubsubPrefix + "is_receipt_modack"
371
368
)
372
369
373
370
func startSpan (ctx context.Context , spanType , resourceID string , opts ... trace.SpanStartOption ) (context.Context , trace.Span ) {
@@ -383,7 +380,7 @@ func getPublishSpanAttributes(project, dst string, msg *Message, attrs ...attrib
383
380
trace .WithAttributes (
384
381
semconv .MessagingMessageID (msg .ID ),
385
382
semconv .MessagingMessageBodySize (len (msg .Data )),
386
- attribute . String ( orderingAttribute , msg .OrderingKey ),
383
+ semconv . MessagingGCPPubsubMessageOrderingKey ( msg .OrderingKey ),
387
384
),
388
385
trace .WithAttributes (attrs ... ),
389
386
trace .WithSpanKind (trace .SpanKindProducer ),
@@ -397,13 +394,13 @@ func getSubscriberOpts(project, dst string, msg *Message, attrs ...attribute.Key
397
394
trace .WithAttributes (
398
395
semconv .MessagingMessageID (msg .ID ),
399
396
semconv .MessagingMessageBodySize (len (msg .Data )),
400
- attribute . String ( orderingAttribute , msg .OrderingKey ),
397
+ semconv . MessagingGCPPubsubMessageOrderingKey ( msg .OrderingKey ),
401
398
),
402
399
trace .WithAttributes (attrs ... ),
403
400
trace .WithSpanKind (trace .SpanKindConsumer ),
404
401
}
405
402
if msg .DeliveryAttempt != nil {
406
- opts = append (opts , trace .WithAttributes (attribute . Int ( deliveryAttemptAttribute , * msg .DeliveryAttempt )))
403
+ opts = append (opts , trace .WithAttributes (semconv . MessagingGCPPubsubMessageDeliveryAttempt ( * msg .DeliveryAttempt )))
407
404
}
408
405
opts = append (opts , getCommonOptions (project , dst )... )
409
406
return opts
0 commit comments