Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Oct 3, 2024
1 parent 7d87f77 commit a0ddae4
Showing 1 changed file with 51 additions and 2 deletions.
53 changes: 51 additions & 2 deletions docs/messaging/messaging-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
- [Examples](#examples)
- [Topic with multiple consumers](#topic-with-multiple-consumers)
- [Batch receiving](#batch-receiving)
- [Batch publishing](#batch-publishing)
- [Batch publishing with "Create" spans](#batch-publishing-with-create-spans)
- [Batch publishing without "Create" spans](#batch-publishing-without-create-spans)

<!-- tocstop -->

Expand Down Expand Up @@ -583,11 +584,14 @@ flowchart LR;
| `messaging.message.id` | `"a1"` | `"a2"` | |
| `messaging.batch.message_count` | | | 2 |

### Batch publishing
### Batch publishing with "Create" spans

Given is a publisher that publishes a batch with two messages to a topic "Q" on
Kafka, and two different consumers receiving one of the messages.

Instrumentation in this case reports "Create" span for each message and a "Publish"
span that's linked to a "Create" span.

```mermaid
flowchart LR;
subgraph PRODUCER
Expand Down Expand Up @@ -629,4 +633,49 @@ flowchart LR;
| `messaging.message.id` | `"a1"` | `"a2"` | | `"a1"` | `"a2"` |
| `messaging.batch.message_count` | | | 2 | | |

### Batch publishing without "Create" spans

Given is a publisher that publishes a batch with two messages to a topic "Q" on
Kafka, and two different consumers receiving one of the messages.

Based on the configuration provided by user, instrumentation in this case reports
"Publish" span only. It injects "Publish" span context into both messages.

```mermaid
flowchart LR;
subgraph PRODUCER
direction TB
P[Span Publish]
end
subgraph CONSUMER1
direction TB
D1[Span Receive A]
end
subgraph CONSUMER2
direction TB
D2[Span Receive B]
end
P-. link .-D1;
P-. link .-D2;
classDef normal fill:green
class P,D1,D2 normal
linkStyle 0,1 color:green,stroke:green
```

| Field or Attribute | Span Publish | Span Receive A | Span Receive B |
|-|-|-|-|
| Span name | `send Q` | `poll Q` | `poll Q` |
| Parent | | | |
| Links | | Span Publish | Span Publish |
| SpanKind | `PRODUCER` | `CONSUMER` | `CONSUMER` |
| `server.address` | `"ms"` | `"ms"` | `"ms"` |
| `server.port` | `1234` | `1234` | `1234` |
| `messaging.system` | `"kafka"` | `"kafka"` | `"kafka"` |
| `messaging.destination.name` | `"Q"` | `"Q"` | `"Q"` |
| `messaging.operation.name` | `"send"` | `"poll"` | `"poll"` |
| `messaging.operation.type` | `"publish"` | `"receive"` | `"receive"` |
| `messaging.message.id` | | `"a1"` | `"a2"` |
| `messaging.batch.message_count`| 2 | | |

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

0 comments on commit a0ddae4

Please sign in to comment.