Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
addressing comments in #13
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsembwever committed Mar 6, 2016
1 parent fd5564d commit cae53ac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
20 changes: 8 additions & 12 deletions opentracing/src/main/java/opentracing/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
package opentracing;

/**
* Span represents an active, un-finished span in the opentracing system.
* Represents an in-flight span in the opentracing system.
*
* <p>Spans are created by the {@link Tracer} interface.
* <p>Spans are created by the {@link Tracer#buildSpan} interface.
*/
public interface Span {

Expand All @@ -30,13 +30,6 @@ public interface Span {

/**
* Set a key:value tag on the Span.
*
* <p>Tag values can be of arbitrary types, however the treatment of complex types is dependent on
* the underlying tracing system implementation. It is expected that most tracing systems will
* handle primitive types like strings and numbers. If a tracing system cannot understand how to
* handle a particular value type, it may ignore the tag, but shall not panic.
*
* <p>If there is a pre-existing tag set for {@code key}, it is overwritten.
*/
// overloaded 3x to support the BasicType concern
Span setTag(String key, String value);
Expand All @@ -54,10 +47,13 @@ public interface Span {
*/
Span setBaggageItem(String key, String value);

/** Get a Baggage item by key. */
/** Get a Baggage item by key.
*
* Returns null if no entry found, or baggage is not supported in the current implementation.
*/
String getBaggageItem(String key);

/** *
/**
* Add a new log event to the Span, accepting an event name string and an optional structured payload argument.
* If specified, the payload argument may be of any type and arbitrary size,
* though implementations are not required to retain all payload arguments
Expand All @@ -76,5 +72,5 @@ public interface Span {
* The timestamp is specified manually here to represent a past log event.
* The timestamp in microseconds in UTC time.
**/
Span log(long instantMicroseconds, String eventName, /* @Nullable */ Object payload);
Span log(long timestampMicroseconds, String eventName, /* @Nullable */ Object payload);
}
26 changes: 20 additions & 6 deletions opentracing/src/main/java/opentracing/Tracer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public interface Tracer {
* a Span instance, and
* a “carrier” object in which to inject that Span for cross-process propagation.
*
* A “carrier” object is some sort of http or rpc envelope, for example HeaderGroup (from Apache HttpComponents).
*
* The low-level format carriers Map&lt;String,String&gt; and ByteBuffer are guaranteed to be supported,
* otherwise only carriers that have been registered are supported.
*
* Attempting to inject to a carrier that has been registered/configured to this Tracer will result in a
* IllegalStateException.
*/
<T> void inject(Span span, T carrier);

Expand All @@ -56,9 +63,16 @@ public interface Tracer {
*
* (Note that some OpenTracing implementations consider the Spans on either side of an RPC to have the same identity,
* and others consider the caller to be the parent and the receiver to be the child)
*
* Attempting to join from a carrier that has been registered/configured to this Tracer will result in a
* IllegalStateException.
*
* If the span serialized state is invalid (corrupt, wrong version, etc) inside the carrier this will result in a
* IllegalArgumentException.
*/
<T> SpanBuilder join(T carrier);


interface SpanBuilder {

/** Specify the operationName.
Expand All @@ -73,12 +87,6 @@ interface SpanBuilder {
*/
SpanBuilder withParent(Span parent);

/** Specify a timestamp the Span actually started from.
*
* If the timestamp has already been set an IllegalStateException will be thrown.
*/
SpanBuilder withTimestamp(long microseconds);

/** Same as {@link Span#setTag(String, String)}, but for the span being built. */
SpanBuilder withTag(String key, String value);

Expand All @@ -88,7 +96,13 @@ interface SpanBuilder {
/** Same as {@link Span#setTag(String, String)}, but for the span being built. */
SpanBuilder withTag(String key, Number value);

/** Specify a timestamp of when the Span was started, represented in microseconds since epoch. */
SpanBuilder withStartTimestamp(long microseconds);

/** Returns the started Span. */
Span start();

/** Returns the Span, with a started timestamp (represented in microseconds) as specified. */
Span start(long microseconds);
}
}

0 comments on commit cae53ac

Please sign in to comment.