Class SdkEventBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.logs.internal.SdkEventBuilder
-
- All Implemented Interfaces:
EventBuilder
class SdkEventBuilder extends java.lang.Object implements EventBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private Clockclockprivate static AttributeKey<java.lang.String>EVENT_NAMEprivate java.lang.StringeventNameprivate booleanhasTimestampprivate LogRecordBuilderlogRecordBuilderprivate java.util.Map<java.lang.String,Value<?>>payload
-
Constructor Summary
Constructors Constructor Description SdkEventBuilder(Clock clock, LogRecordBuilder logRecordBuilder, java.lang.String eventName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidemit()Emit an event.EventBuilderput(java.lang.String key, Value<?> value)Put the givenkeyandvaluein the payload.EventBuildersetAttributes(Attributes attributes)Set the attributes.EventBuildersetContext(Context context)Set the context.EventBuildersetSeverity(Severity severity)Set the severity.EventBuildersetTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)Set the epochtimestamp, using the timestamp and unit.EventBuildersetTimestamp(java.time.Instant instant)Set the epochtimestamp, using the instant.
-
-
-
Field Detail
-
EVENT_NAME
private static final AttributeKey<java.lang.String> EVENT_NAME
-
payload
private final java.util.Map<java.lang.String,Value<?>> payload
-
clock
private final Clock clock
-
logRecordBuilder
private final LogRecordBuilder logRecordBuilder
-
eventName
private final java.lang.String eventName
-
hasTimestamp
private boolean hasTimestamp
-
-
Constructor Detail
-
SdkEventBuilder
SdkEventBuilder(Clock clock, LogRecordBuilder logRecordBuilder, java.lang.String eventName)
-
-
Method Detail
-
put
public EventBuilder put(java.lang.String key, Value<?> value)
Description copied from interface:EventBuilderPut the givenkeyandvaluein the payload.- Specified by:
putin interfaceEventBuilder
-
setTimestamp
public EventBuilder setTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Description copied from interface:EventBuilderSet the epochtimestamp, using the timestamp and unit.The
timestampis the time at which the event occurred. If unset, it will be set to the current time whenEventBuilder.emit()is called.- Specified by:
setTimestampin interfaceEventBuilder
-
setTimestamp
public EventBuilder setTimestamp(java.time.Instant instant)
Description copied from interface:EventBuilderSet the epochtimestamp, using the instant.The
timestampis the time at which the event occurred. If unset, it will be set to the current time whenEventBuilder.emit()is called.- Specified by:
setTimestampin interfaceEventBuilder
-
setContext
public EventBuilder setContext(Context context)
Description copied from interface:EventBuilderSet the context.- Specified by:
setContextin interfaceEventBuilder
-
setSeverity
public EventBuilder setSeverity(Severity severity)
Description copied from interface:EventBuilderSet the severity.- Specified by:
setSeverityin interfaceEventBuilder
-
setAttributes
public EventBuilder setAttributes(Attributes attributes)
Description copied from interface:EventBuilderSet the attributes.Event
Attributesprovide additional details about the Event which are not part of the well-definedValuepayload. Setting event attributes is less common than adding entries to the event payload. Most users will want to call one of the#put(String, ?)methods instead.- Specified by:
setAttributesin interfaceEventBuilder
-
emit
public void emit()
Description copied from interface:EventBuilderEmit an event.- Specified by:
emitin interfaceEventBuilder
-
-