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 Clock
clock
private static AttributeKey<java.lang.String>
EVENT_NAME
private java.lang.String
eventName
private boolean
hasTimestamp
private LogRecordBuilder
logRecordBuilder
private 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 void
emit()
Emit an event.EventBuilder
put(java.lang.String key, Value<?> value)
Put the givenkey
andvalue
in the payload.EventBuilder
setAttributes(Attributes attributes)
Set the attributes.EventBuilder
setContext(Context context)
Set the context.EventBuilder
setSeverity(Severity severity)
Set the severity.EventBuilder
setTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Set the epochtimestamp
, using the timestamp and unit.EventBuilder
setTimestamp(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:EventBuilder
Put the givenkey
andvalue
in the payload.- Specified by:
put
in interfaceEventBuilder
-
setTimestamp
public EventBuilder setTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Description copied from interface:EventBuilder
Set the epochtimestamp
, using the timestamp and unit.The
timestamp
is the time at which the event occurred. If unset, it will be set to the current time whenEventBuilder.emit()
is called.- Specified by:
setTimestamp
in interfaceEventBuilder
-
setTimestamp
public EventBuilder setTimestamp(java.time.Instant instant)
Description copied from interface:EventBuilder
Set the epochtimestamp
, using the instant.The
timestamp
is the time at which the event occurred. If unset, it will be set to the current time whenEventBuilder.emit()
is called.- Specified by:
setTimestamp
in interfaceEventBuilder
-
setContext
public EventBuilder setContext(Context context)
Description copied from interface:EventBuilder
Set the context.- Specified by:
setContext
in interfaceEventBuilder
-
setSeverity
public EventBuilder setSeverity(Severity severity)
Description copied from interface:EventBuilder
Set the severity.- Specified by:
setSeverity
in interfaceEventBuilder
-
setAttributes
public EventBuilder setAttributes(Attributes attributes)
Description copied from interface:EventBuilder
Set the attributes.Event
Attributes
provide additional details about the Event which are not part of the well-definedValue
payload. 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:
setAttributes
in interfaceEventBuilder
-
emit
public void emit()
Description copied from interface:EventBuilder
Emit an event.- Specified by:
emit
in interfaceEventBuilder
-
-