@@ -360,14 +360,11 @@ const (
360360 resultExpired = "expired"
361361
362362 // 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"
371368)
372369
373370func 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
383380 trace .WithAttributes (
384381 semconv .MessagingMessageID (msg .ID ),
385382 semconv .MessagingMessageBodySize (len (msg .Data )),
386- attribute . String ( orderingAttribute , msg .OrderingKey ),
383+ semconv . MessagingGCPPubsubMessageOrderingKey ( msg .OrderingKey ),
387384 ),
388385 trace .WithAttributes (attrs ... ),
389386 trace .WithSpanKind (trace .SpanKindProducer ),
@@ -397,13 +394,13 @@ func getSubscriberOpts(project, dst string, msg *Message, attrs ...attribute.Key
397394 trace .WithAttributes (
398395 semconv .MessagingMessageID (msg .ID ),
399396 semconv .MessagingMessageBodySize (len (msg .Data )),
400- attribute . String ( orderingAttribute , msg .OrderingKey ),
397+ semconv . MessagingGCPPubsubMessageOrderingKey ( msg .OrderingKey ),
401398 ),
402399 trace .WithAttributes (attrs ... ),
403400 trace .WithSpanKind (trace .SpanKindConsumer ),
404401 }
405402 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 )))
407404 }
408405 opts = append (opts , getCommonOptions (project , dst )... )
409406 return opts
0 commit comments