diff --git a/opentracing/src/main/java/opentracing/Span.java b/opentracing/src/main/java/opentracing/Span.java index 8269a8af..2b093603 100644 --- a/opentracing/src/main/java/opentracing/Span.java +++ b/opentracing/src/main/java/opentracing/Span.java @@ -57,24 +57,28 @@ public interface Span { /** Get a Baggage item by key. */ 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 - * (or even all parts of all payload arguments). - * - * The timestamp of this log event is the current time. - **/ - Span log(String eventName, /* @Nullable */ Object payload); - /** - * 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 - * (or even all parts of all payload arguments). + * Create an event builder, specifying the mandatory event name string. * - * The timestamp is specified manually here to represent a past log event. - * The timestamp in microseconds in UTC time. + * The timestamp of this log event is by default the time the EventBuilder is constructed. **/ - Span log(long instantMicroseconds, String eventName, /* @Nullable */ Object payload); + EventBuilder buildEvent(String eventName); + + interface EventBuilder { + /** + * Add the 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 + * (or even all parts of all payload arguments). + **/ + EventBuilder withPayload(Object payload); + + /** + * Add a specific timestamp, in microseconds in UTC time. + **/ + EventBuilder withTimestamp(long microseconds); + + /** Build the log event, adding it to the Span, then return the Span. */ + Span log(); + } }