GoogleCloudPlatform / cloud-trace-java

Apache License 2.0
48 stars 42 forks source link

Add PRODUCER and CONSUMER span kinds #104

Open joaoandremartins opened 6 years ago

joaoandremartins commented 6 years ago

Not sure if this is the correct place to file this issue. Please let me know if I should be knocking at someone else's door.

Besides CLIENT and SERVER span types, Zipkin also contemplates PRODUCER and CONSUMER spans.

For example, for PRODUCER, JavaDoc says:

/**

  • When present, {@link #timestamp()} is the moment a producer sent a message to a destination.
  • {@link #duration()} represents delay sending the message, such as batching, while {@link
  • remoteEndpoint()} indicates the destination, such as a broker.

  • ke {@link #CLIENT}, messaging spans never share a span ID. For example, the {@link
  • CONSUMER} of the same message has {@link #parentId()} set to this span's {@link #id()}.

In Spring Cloud GCP, we integrate Zipkin with Stackdriver Trace, so traces processed by Zipkin are stored in Stackdriver Trace.

We do a mapping of Zipkin to Stackdriver Trace span kind, but Stackdriver Trace doesn't have an obvious mapping for PRODUCER and CONSUMER.

Would it make sense to add them to Stackdriver Trace as well?

My gut feeling is that, because PRODUCER and CONSUMER don't share their trace ID with any spans, it can probably left out as UNSPECIFIED, but would like to double check this with the Stackdriver Trace team.