Interface ReadWriteLogRecord


public interface ReadWriteLogRecord
A log record that can be read from and written to.
Since:
1.27.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> T
    getAttribute(io.opentelemetry.api.common.AttributeKey<T> key)
    Returns the value of a given attribute if it exists.
    default io.opentelemetry.api.common.Attributes
    Returns the attributes for this log, or Attributes.empty() if unset.
    default io.opentelemetry.api.common.Value<?>
    Returns the Value representation of the log body, of null if unset.
    default String
    Returns the log record event name, or null if none is set.
    default io.opentelemetry.sdk.common.InstrumentationScopeInfo
    Returns the instrumentation scope that generated this log.
    default long
    Returns the timestamp at which the log record was observed, in epoch nanos.
    default io.opentelemetry.api.logs.Severity
    Returns the severity for this log, or Severity.UNDEFINED_SEVERITY_NUMBER if unset.
    default String
    Returns the severity text for this log, or null if unset.
    default io.opentelemetry.api.trace.SpanContext
    Return the span context for this log, or SpanContext.getInvalid() if unset.
    default long
    Returns the timestamp at which the log record occurred, in epoch nanos.
    setAllAttributes(io.opentelemetry.api.common.Attributes attributes)
    Sets attributes to the ReadWriteLogRecord.
    setAttribute(io.opentelemetry.api.common.AttributeKey<T> key, T value)
    Sets an attribute on the log record.
    Return an immutable LogRecordData instance representing this log record.
  • Method Details

    • setAttribute

      <T> ReadWriteLogRecord setAttribute(io.opentelemetry.api.common.AttributeKey<T> key, T value)
      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

      default ReadWriteLogRecord setAllAttributes(io.opentelemetry.api.common.Attributes attributes)
      Sets attributes to the ReadWriteLogRecord. If the ReadWriteLogRecord previously 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 immutable LogRecordData instance representing this log record.
    • getEventName

      @Nullable default String getEventName()
      Returns the log record event name, or null if none is set.
      Since:
      1.50.0
    • getAttribute

      @Nullable default <T> T getAttribute(io.opentelemetry.api.common.AttributeKey<T> key)
      Returns the value of a given attribute if it exists. This is the equivalent of calling getAttributes().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, or SpanContext.getInvalid() if unset.
      Since:
      1.46.0
    • getSeverity

      default io.opentelemetry.api.logs.Severity getSeverity()
      Returns the severity for this log, or Severity.UNDEFINED_SEVERITY_NUMBER if unset.
      Since:
      1.46.0
    • getSeverityText

      @Nullable default String getSeverityText()
      Returns the severity text for this log, or null if unset.
      Since:
      1.46.0
    • getBodyValue

      @Nullable default io.opentelemetry.api.common.Value<?> getBodyValue()
      Returns the Value representation 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, or Attributes.empty() if unset.
      Since:
      1.46.0