-
Notifications
You must be signed in to change notification settings - Fork 343
Discrepancy: Join can create a new trace in Java, but not in Go/Python #26
Comments
I feel a bit uneasy about Per the edit: tldr; I prefer the Go/Python semantics |
@bg451 I agree. I prefer Go/Python behavior, it keeps the interface to minimal functionality. |
+1; there is real value in a method that attempts to |
I'm no fan of asking the client code to use try-catch. I'd suggest either have join(..) return a NoopSpanBuilder, or change the signature on join(..) to
Or add to SpanBuilder the method Otherwise the code isn't determined one way or another, as it's the registered Extractor and SpanBuilder that will throw the exception when there isn't enough, or valid, traceState. |
Coming back to this my thoughts favour returning It works well when the typical use-case is not to instrument if trace exists already. And when instrumentation wants to be started despite no existing trace then it's to
|
The Using Returning a If the typical usage of this method is for the callers to almost always check the return value, how about interface SpanBuilder {
interface Supplier /* extends java.util.function.Supplier<SpanBuilder> on Java 8 */ {
SpanBuilder get();
}
...
}
// Assuming hypothetical global tracer API, extract context or use root span
Span span = tracer.joinOr(carrier, GlobalTracer::rootSpan).withOperationName("op"); This is somewhat inconvenient for folks using Java 7; you could provide a // On Java 7, easy way to use a no-op instance
Span span = tracer.joinOr(carrier, NoopSpanBuilder.INSTANCE).withOperationName("op"); |
Note: with #32 this is no longer an issue, imo. The |
Yes, this is (happily) a moot point in the post- We should close this once #32 is in. |
Documentation for Join method says
This is different from Go/Python implementations where Join operation results in an error if the incoming request contains no trace context. Java versions provides no hook for instrumentation to decide if it wants a new trace started if one didn't come from upstream. On the other hand, it makes instrumentation code shorter by not forcing the end user to do:
I think we should be consistent in the semantics of Join operation across languages.
@bensigelman @michaelsembwever @oibe
The text was updated successfully, but these errors were encountered: