zipkin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-zipkin-brave] adriancole commented on a change in pull request #904: Messaging adapter
Date Mon, 20 May 2019 13:34:10 GMT
adriancole commented on a change in pull request #904: Messaging adapter
URL: https://github.com/apache/incubator-zipkin-brave/pull/904#discussion_r285594644
 
 

 ##########
 File path: instrumentation/messaging/src/main/java/brave/messaging/MessagingParser.java
 ##########
 @@ -0,0 +1,43 @@
+package brave.messaging;
+
+import brave.SpanCustomizer;
+import brave.propagation.TraceContext;
+import brave.propagation.TraceContextOrSamplingFlags;
+
+public class MessagingParser {
+
+  public <Chan, Msg> void message(ChannelAdapter<Chan> channelAdapter,
+      MessageAdapter<Msg> messageAdapter,
+      Chan channel, Msg message, SpanCustomizer customizer) {
+    customizer.name(messageAdapter.operation(message));
+    channel(channelAdapter, channel, customizer);
+    identifier(messageAdapter, message, customizer);
+  }
+
+  public <Chan> void channel(ChannelAdapter<Chan> adapter, Chan chan,
+      SpanCustomizer customizer) {
+    String channel = adapter.channel(chan);
+    if (chan != null) customizer.tag(adapter.channelTagKey(chan), channel);
+  }
+
+  public <Msg> void identifier(MessageAdapter<Msg> adapter, Msg message,
+      SpanCustomizer customizer) {
+    String identifier = adapter.identifier(message);
+    if (identifier != null) {
+      customizer.tag(adapter.identifierTagKey(), adapter.identifier(message));
 
 Review comment:
   ```suggestion
         customizer.tag(adapter.identifierTagKey(), identifier);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@zipkin.apache.org
For additional commands, e-mail: dev-help@zipkin.apache.org


Mime
View raw message