Class SdkLogRecordBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.logs.SdkLogRecordBuilder
-
- All Implemented Interfaces:
ExtendedLogRecordBuilder
,LogRecordBuilder
final class SdkLogRecordBuilder extends java.lang.Object implements ExtendedLogRecordBuilder
SDK implementation ofLogRecordBuilder
.
-
-
Field Summary
Fields Modifier and Type Field Description private AttributesMap
attributes
private Value<?>
body
private Context
context
private InstrumentationScopeInfo
instrumentationScopeInfo
private LoggerSharedState
loggerSharedState
private LogLimits
logLimits
private long
observedTimestampEpochNanos
private Severity
severity
private java.lang.String
severityText
private long
timestampEpochNanos
-
Constructor Summary
Constructors Constructor Description SdkLogRecordBuilder(LoggerSharedState loggerSharedState, InstrumentationScopeInfo instrumentationScopeInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
emit()
Emit the log record.<T> SdkLogRecordBuilder
setAttribute(AttributeKey<T> key, T value)
Sets an attribute.SdkLogRecordBuilder
setBody(Value<?> value)
Set the bodyValue
.SdkLogRecordBuilder
setBody(java.lang.String body)
Set the body string.SdkLogRecordBuilder
setContext(Context context)
Set the context.LogRecordBuilder
setObservedTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Set the epochobservedTimestamp
, using the timestamp and unit.LogRecordBuilder
setObservedTimestamp(java.time.Instant instant)
Set theobservedTimestamp
, using the instant.SdkLogRecordBuilder
setSeverity(Severity severity)
Set the severity.SdkLogRecordBuilder
setSeverityText(java.lang.String severityText)
Set the severity text.SdkLogRecordBuilder
setTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Set the epochtimestamp
, using the timestamp and unit.SdkLogRecordBuilder
setTimestamp(java.time.Instant instant)
Set the epochtimestamp
, using the instant.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.api.logs.LogRecordBuilder
setAllAttributes
-
-
-
-
Field Detail
-
loggerSharedState
private final LoggerSharedState loggerSharedState
-
logLimits
private final LogLimits logLimits
-
instrumentationScopeInfo
private final InstrumentationScopeInfo instrumentationScopeInfo
-
timestampEpochNanos
private long timestampEpochNanos
-
observedTimestampEpochNanos
private long observedTimestampEpochNanos
-
context
@Nullable private Context context
-
severity
private Severity severity
-
severityText
@Nullable private java.lang.String severityText
-
body
@Nullable private Value<?> body
-
attributes
@Nullable private AttributesMap attributes
-
-
Constructor Detail
-
SdkLogRecordBuilder
SdkLogRecordBuilder(LoggerSharedState loggerSharedState, InstrumentationScopeInfo instrumentationScopeInfo)
-
-
Method Detail
-
setTimestamp
public SdkLogRecordBuilder setTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Description copied from interface:LogRecordBuilder
Set the epochtimestamp
, using the timestamp and unit.The
timestamp
is the time at which the log record occurred. If unset, it will be set to the current time whenLogRecordBuilder.emit()
is called.- Specified by:
setTimestamp
in interfaceLogRecordBuilder
-
setTimestamp
public SdkLogRecordBuilder setTimestamp(java.time.Instant instant)
Description copied from interface:LogRecordBuilder
Set the epochtimestamp
, using the instant.The
timestamp
is the time at which the log record occurred. If unset, it will be set to the current time whenLogRecordBuilder.emit()
is called.- Specified by:
setTimestamp
in interfaceLogRecordBuilder
-
setObservedTimestamp
public LogRecordBuilder setObservedTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Description copied from interface:LogRecordBuilder
Set the epochobservedTimestamp
, using the timestamp and unit.The
observedTimestamp
is the time at which the log record was observed. If unset, it will be set to thetimestamp
.observedTimestamp
may be different fromtimestamp
if logs are being processed asynchronously (e.g. from a file or on a different thread).- Specified by:
setObservedTimestamp
in interfaceLogRecordBuilder
-
setObservedTimestamp
public LogRecordBuilder setObservedTimestamp(java.time.Instant instant)
Description copied from interface:LogRecordBuilder
Set theobservedTimestamp
, using the instant.The
observedTimestamp
is the time at which the log record was observed. If unset, it will be set to thetimestamp
.observedTimestamp
may be different fromtimestamp
if logs are being processed asynchronously (e.g. from a file or on a different thread).- Specified by:
setObservedTimestamp
in interfaceLogRecordBuilder
-
setContext
public SdkLogRecordBuilder setContext(Context context)
Description copied from interface:LogRecordBuilder
Set the context.- Specified by:
setContext
in interfaceLogRecordBuilder
-
setSeverity
public SdkLogRecordBuilder setSeverity(Severity severity)
Description copied from interface:LogRecordBuilder
Set the severity.- Specified by:
setSeverity
in interfaceLogRecordBuilder
-
setSeverityText
public SdkLogRecordBuilder setSeverityText(java.lang.String severityText)
Description copied from interface:LogRecordBuilder
Set the severity text.- Specified by:
setSeverityText
in interfaceLogRecordBuilder
-
setBody
public SdkLogRecordBuilder setBody(java.lang.String body)
Description copied from interface:LogRecordBuilder
Set the body string.Shorthand for calling
LogRecordBuilder.setBody(Value)
withValue.of(String)
.- Specified by:
setBody
in interfaceLogRecordBuilder
-
setBody
public SdkLogRecordBuilder setBody(Value<?> value)
Description copied from interface:LogRecordBuilder
Set the bodyValue
.- Specified by:
setBody
in interfaceLogRecordBuilder
-
setAttribute
public <T> SdkLogRecordBuilder setAttribute(AttributeKey<T> key, T value)
Description copied from interface:LogRecordBuilder
Sets an attribute.- Specified by:
setAttribute
in interfaceLogRecordBuilder
-
emit
public void emit()
Description copied from interface:LogRecordBuilder
Emit the log record.- Specified by:
emit
in interfaceLogRecordBuilder
-
-