Instrumenting batching scenarios
Instrumentation for batching scenarios can be different depending on the use case – transport-level batching needs a slightly different approach compared to batch processing.
Batching on a transport level
Messages can be batched together to minimize the number of network calls. It can be used by producers or consumers, and systems such as Kafka, Amazon SQS, or Azure Service Bus support batching on both sides.
On the consumer, when multiple messages are received together but processed independently, everything we had for single message processing still applies.
From a tracing perspective, the only thing we’d want to change is to add attributes that record all received message identifiers and batch size on the outer iteration activity.
From the metrics side, we’d also want to measure individual message processing duration, error rate, and throughput. We can track them all by adding a message processing duration histogram...