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 AttributesMapattributesprivate Value<?>bodyprivate Contextcontextprivate InstrumentationScopeInfoinstrumentationScopeInfoprivate LoggerSharedStateloggerSharedStateprivate LogLimitslogLimitsprivate longobservedTimestampEpochNanosprivate Severityseverityprivate java.lang.StringseverityTextprivate longtimestampEpochNanos
-
Constructor Summary
Constructors Constructor Description SdkLogRecordBuilder(LoggerSharedState loggerSharedState, InstrumentationScopeInfo instrumentationScopeInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidemit()Emit the log record.<T> SdkLogRecordBuildersetAttribute(AttributeKey<T> key, T value)Sets an attribute.SdkLogRecordBuildersetBody(Value<?> value)Set the bodyValue.SdkLogRecordBuildersetBody(java.lang.String body)Set the body string.SdkLogRecordBuildersetContext(Context context)Set the context.LogRecordBuildersetObservedTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)Set the epochobservedTimestamp, using the timestamp and unit.LogRecordBuildersetObservedTimestamp(java.time.Instant instant)Set theobservedTimestamp, using the instant.SdkLogRecordBuildersetSeverity(Severity severity)Set the severity.SdkLogRecordBuildersetSeverityText(java.lang.String severityText)Set the severity text.SdkLogRecordBuildersetTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)Set the epochtimestamp, using the timestamp and unit.SdkLogRecordBuildersetTimestamp(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:LogRecordBuilderSet the epochtimestamp, using the timestamp and unit.The
timestampis the time at which the log record occurred. If unset, it will be set to the current time whenLogRecordBuilder.emit()is called.- Specified by:
setTimestampin interfaceLogRecordBuilder
-
setTimestamp
public SdkLogRecordBuilder setTimestamp(java.time.Instant instant)
Description copied from interface:LogRecordBuilderSet the epochtimestamp, using the instant.The
timestampis the time at which the log record occurred. If unset, it will be set to the current time whenLogRecordBuilder.emit()is called.- Specified by:
setTimestampin interfaceLogRecordBuilder
-
setObservedTimestamp
public LogRecordBuilder setObservedTimestamp(long timestamp, java.util.concurrent.TimeUnit unit)
Description copied from interface:LogRecordBuilderSet the epochobservedTimestamp, using the timestamp and unit.The
observedTimestampis the time at which the log record was observed. If unset, it will be set to thetimestamp.observedTimestampmay be different fromtimestampif logs are being processed asynchronously (e.g. from a file or on a different thread).- Specified by:
setObservedTimestampin interfaceLogRecordBuilder
-
setObservedTimestamp
public LogRecordBuilder setObservedTimestamp(java.time.Instant instant)
Description copied from interface:LogRecordBuilderSet theobservedTimestamp, using the instant.The
observedTimestampis the time at which the log record was observed. If unset, it will be set to thetimestamp.observedTimestampmay be different fromtimestampif logs are being processed asynchronously (e.g. from a file or on a different thread).- Specified by:
setObservedTimestampin interfaceLogRecordBuilder
-
setContext
public SdkLogRecordBuilder setContext(Context context)
Description copied from interface:LogRecordBuilderSet the context.- Specified by:
setContextin interfaceLogRecordBuilder
-
setSeverity
public SdkLogRecordBuilder setSeverity(Severity severity)
Description copied from interface:LogRecordBuilderSet the severity.- Specified by:
setSeverityin interfaceLogRecordBuilder
-
setSeverityText
public SdkLogRecordBuilder setSeverityText(java.lang.String severityText)
Description copied from interface:LogRecordBuilderSet the severity text.- Specified by:
setSeverityTextin interfaceLogRecordBuilder
-
setBody
public SdkLogRecordBuilder setBody(java.lang.String body)
Description copied from interface:LogRecordBuilderSet the body string.Shorthand for calling
LogRecordBuilder.setBody(Value)withValue.of(String).- Specified by:
setBodyin interfaceLogRecordBuilder
-
setBody
public SdkLogRecordBuilder setBody(Value<?> value)
Description copied from interface:LogRecordBuilderSet the bodyValue.- Specified by:
setBodyin interfaceLogRecordBuilder
-
setAttribute
public <T> SdkLogRecordBuilder setAttribute(AttributeKey<T> key, T value)
Description copied from interface:LogRecordBuilderSets an attribute.- Specified by:
setAttributein interfaceLogRecordBuilder
-
emit
public void emit()
Description copied from interface:LogRecordBuilderEmit the log record.- Specified by:
emitin interfaceLogRecordBuilder
-
-