Skip to content

Commit

Permalink
Give exhaustive specification of span kinds for messaging spans (#1171)
Browse files Browse the repository at this point in the history
Co-authored-by: Liudmila Molkova <[email protected]>
Co-authored-by: Joao Grassi <[email protected]>
  • Loading branch information
3 people committed Sep 16, 2024
1 parent f14f54c commit 422eeb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .chloggen/1112.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
change_type: enhancement
component: messaging
note: Define span kind for unspecified cases of messaging `publish` and `process` spans.
issues: [1112]
22 changes: 7 additions & 15 deletions docs/messaging/messaging-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,13 @@ Span kind SHOULD be set according to the following table, based on the operation

| Operation type | Span kind|
|----------------|-------------|
| `create` | `PRODUCER` |
| `publish` | `PRODUCER` if the context of the "Publish" span is used as creation context. |
| `receive` | `CONSUMER` |
| `process` | `CONSUMER` for push-based scenarios where no "Receive" span exists. |

For cases not covered by the table above, the span kind should be set according
to the [generic specification about span kinds](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.35.0/specification/trace/api.md#spankind),
e. g. it should be set to CLIENT for the "Publish" span if its context is not
used as creation context and if the "Publish" span models a synchronous call to
the intermediary.

Setting span kinds according to this table ensures that span links between
consumers and producers always exist between a PRODUCER span on the producer
side and a CONSUMER span on the consumer side. This allows analysis tools to
interpret linked traces without the need for additional semantic hints.
| `create` | `PRODUCER` |
| `publish` | `PRODUCER` if the context of the "Publish" span is used as creation context, otherwise `CLIENT`. |
| `receive` | `CLIENT` |
| `process` | `CONSUMER` |

Setting span kinds according to this table allows analysis tools to interpret spans
and relationships between them without the need for additional semantic hints.

### Trace structure

Expand Down

0 comments on commit 422eeb7

Please sign in to comment.