Semantic Conventions for Google Cloud Pub/Sub

Status: Experimental

The Semantic Conventions for Google Cloud Pub/Sub extend and override the Messaging Semantic Conventions that describe common messaging operations attributes in addition to the Semantic Conventions described on this page.

messaging.system MUST be set to "gcp_pubsub".

Span attributes

For Google Cloud Pub/Sub, the following additional attributes are defined:

AttributeTypeDescriptionExamplesRequirement LevelStability
messaging.gcp_pubsub.message.ordering_keystringThe ordering key for a given message. If the attribute is not present, the message does not have an ordering key.ordering_keyConditionally Required If the message type has an ordering key set.Experimental

Examples

Asynchronous Batch Publish Example

Given is a process P that asynchronously publishes 2 messages in a batch to a topic T on Pub/Sub.

flowchart LR;
  subgraph PRODUCER
  direction LR
  CA[Span Create A]
  CB[Span Create B]
  P[Span Publish A B]
  end
  CA-. link .-P;
  CB-. link .-P;

  classDef producer fill:green
  class P,CA,CB producer
  classDef normal fill:green
  class PA,PB,D1 normal
  linkStyle 0,1 color:green,stroke:green
Field or AttributeSpan Create ASpan Create BSpan Publish A B
Span nameT createT createpublish
Parent
LinksSpan Create A, Span Create B
SpanKindPRODUCERPRODUCERCLIENT
StatusOkOkOk
messaging.batch.message_count2
messaging.destination.name"T""T""T"
messaging.operation"create""create""publish"
messaging.message.id"a1""a2"
messaging.message.envelope.size11
messaging.system"gcp_pubsub""gcp_pubsub""gcp_pubsub"