Package io.opentelemetry.sdk.logs
Interface ReadWriteLogRecord
public interface ReadWriteLogRecord
A log record that can be read from and written to.
- Since:
- 1.27.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> TgetAttribute(io.opentelemetry.api.common.AttributeKey<T> key) Returns the value of a given attribute if it exists.default io.opentelemetry.api.common.AttributesReturns the attributes for this log, orAttributes.empty()if unset.default io.opentelemetry.api.common.Value<?>Returns theValuerepresentation of the log body, of null if unset.default StringReturns the log record event name, ornullif none is set.default io.opentelemetry.sdk.common.InstrumentationScopeInfoReturns the instrumentation scope that generated this log.default longReturns the timestamp at which the log record was observed, in epoch nanos.default io.opentelemetry.api.logs.SeverityReturns the severity for this log, orSeverity.UNDEFINED_SEVERITY_NUMBERif unset.default StringReturns the severity text for this log, or null if unset.default io.opentelemetry.api.trace.SpanContextReturn the span context for this log, orSpanContext.getInvalid()if unset.default longReturns the timestamp at which the log record occurred, in epoch nanos.default ReadWriteLogRecordsetAllAttributes(io.opentelemetry.api.common.Attributes attributes) Sets attributes to theReadWriteLogRecord.setAttribute(io.opentelemetry.api.common.AttributeKey<T> key, T value) Sets an attribute on the log record.Return an immutableLogRecordDatainstance representing this log record.
-
Method Details
-
setAttribute
Sets an attribute on the log record. If the log record previously contained a mapping for the key, the old value is replaced by the specified value.Note: the behavior of null values is undefined, and hence strongly discouraged.
-
setAllAttributes
Sets attributes to theReadWriteLogRecord. If theReadWriteLogRecordpreviously contained a mapping for any of the keys, the old values are replaced by the specified values.- Parameters:
attributes- the attributes- Returns:
- this.
- Since:
- 1.31.0
-
toLogRecordData
LogRecordData toLogRecordData()Return an immutableLogRecordDatainstance representing this log record. -
getEventName
Returns the log record event name, ornullif none is set.- Since:
- 1.50.0
-
getAttribute
Returns the value of a given attribute if it exists. This is the equivalent of callinggetAttributes().get(key).- Since:
- 1.46.0
-
getInstrumentationScopeInfo
default io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()Returns the instrumentation scope that generated this log.- Since:
- 1.46.0
-
getTimestampEpochNanos
default long getTimestampEpochNanos()Returns the timestamp at which the log record occurred, in epoch nanos.- Since:
- 1.46.0
-
getObservedTimestampEpochNanos
default long getObservedTimestampEpochNanos()Returns the timestamp at which the log record was observed, in epoch nanos.- Since:
- 1.46.0
-
getSpanContext
default io.opentelemetry.api.trace.SpanContext getSpanContext()Return the span context for this log, orSpanContext.getInvalid()if unset.- Since:
- 1.46.0
-
getSeverity
default io.opentelemetry.api.logs.Severity getSeverity()Returns the severity for this log, orSeverity.UNDEFINED_SEVERITY_NUMBERif unset.- Since:
- 1.46.0
-
getSeverityText
Returns the severity text for this log, or null if unset.- Since:
- 1.46.0
-
getBodyValue
Returns theValuerepresentation of the log body, of null if unset.- Since:
- 1.46.0
-
getAttributes
default io.opentelemetry.api.common.Attributes getAttributes()Returns the attributes for this log, orAttributes.empty()if unset.- Since:
- 1.46.0
-