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 #917: Refactors to reduce injector complexity and duplicate code
Date Tue, 04 Jun 2019 01:23:59 GMT
adriancole commented on a change in pull request #917: Refactors to reduce injector complexity
and duplicate code
URL: https://github.com/apache/incubator-zipkin-brave/pull/917#discussion_r290096287
 
 

 ##########
 File path: instrumentation/messaging/src/main/java/brave/messaging/MessagingAdapter.java
 ##########
 @@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package brave.messaging;
+
+import brave.Span;
+import brave.internal.Nullable;
+
+/**
+ * @param <Chan> the type of the channel
+ * @param <Msg> the type of the message
+ * @param <C> the type that carriers the trace context, usually headers
+ */
+// abstract class instead of interface to allow method adds before Java 1.8
+public abstract class MessagingAdapter<Chan, Msg, C> {
+  // TODO: make some of these methods not abstract as they don't have meaning for all impls
+
+  /** Returns the trace context carrier from the message. Usually, this is headers. */
+  public abstract C carrier(Msg message);
+
+  /**
+   * Messaging channel, e.g. kafka queue or JMS topic name. {@code null} if unreadable.
+   *
+   * <p>Conventionally associated with the key "message.channel"
+   */
+  @Nullable public abstract String channel(Chan channel);
+
+  /**
+   * Type of channel, e.g. queue or topic. {@code null} if unreadable.
+   *
+   * <p>Conventionally associated with the key "message.channel_type"
+   */
+  // TODO: naming is arbitrary.. we once used "kind" for Span but only because stackdriver
did..
 
 Review comment:
   sgtm

----------------------------------------------------------------
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