dpol1 commented on code in PR #9154: URL: https://github.com/apache/storm/pull/9154#discussion_r4272286294
########## storm-client/src/jvm/org/apache/storm/tracing/TupleTracer.java: ########## @@ -0,0 +1,103 @@ +/** + * 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 org.apache.storm.tracing; + +import java.util.List; +import java.util.Map; +import org.apache.storm.Config; +import org.apache.storm.task.WorkerTopologyContext; +import org.apache.storm.tuple.Tuple; + +/** + * Attaches a trace context to tuples and records how their tuple trees are processed. Each worker creates one instance from the + * class named in {@link Config#TOPOLOGY_TRACING_TRACER}, through its zero-arg constructor, and shares it between its executors + * and the threads that serialize and deserialize tuples, so implementations must be thread safe. + * + * <p>A context is any object the implementation chooses; null means not traced. Storm keeps it on the tuple and, for the tuple + * trees a spout starts, until the tree completes. Tuples sent to another worker carry the bytes {@link #encode} returns, and the + * receiving worker turns them back into a context with {@link #decode}. + * + * <p>An exception from {@link #decode} leaves the tuple without a context. Exceptions from the other methods propagate to the + * caller. + */ +public interface TupleTracer { + + /** + * Called once, before any other method. + */ + void prepare(Map<String, Object> topoConf, WorkerTopologyContext context); Review Comment: The bundled tracer only borrows a `Tracer` from the SDK registered as the global instance, the agent's or the application's, and holds nothing it would need to close. It would leave this hook empty. A tracer that owns its SDK would need it, I agree. Could we add it when such a tracer comes along, and decide then when Storm calls it and which threads may still be using the tracer? Adding a default method later stays binary compatible. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
