Repository: open-telemetry/opentelemetry-java
File: sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java (Java)

Code before:
   */
  @SuppressWarnings("unchecked")
  default ReadWriteLogRecord setAllAttributes(Attributes attributes) {
    if (attributes == null || attributes.isEmpty()) {
      return this;
    }
    attributes.forEach(
        (attributeKey, value) -> this.setAttribute((AttributeKey<Object>) attributeKey, value));
    return this;
  }

  /** Return an immutable {@link LogRecordData} instance representing this log record. */
  LogRecordData toLogRecordData();

  /**
   * Returns the value of a given attribute if it exists. This is the equivalent of calling
   * getAttributes().get(key)
   */
  @Nullable
  default <T> T getAttribute(AttributeKey<T> key) {
    return toLogRecordData().getAttributes().get(key);
  }

  /** Returns the resource of this log record. */
  @Override
  default Resource getResource() {
    return toLogRecordData().getResource();
  }

  /** Returns the instrumentation scope that generated this log. */
  @Override
  default InstrumentationScopeInfo getInstrumentationScopeInfo() {
    return toLogRecordData().getInstrumentationScopeInfo();
  }

  /** Returns the timestamp at which the log record occurred, in epoch nanos. */
  @Override
  default long getTimestampEpochNanos() {
    return toLogRecordData().getTimestampEpochNanos();
  }

  /** Returns the timestamp at which the log record was observed, in epoch nanos. */
  @Override
  default long getObservedTimestampEpochNanos() {
    return toLogRecordData().getTimestampEpochNanos();
  }

  /** Return the span context for this log, or {@link SpanContext#getInvalid()} if unset. */
  @Override
  default SpanContext getSpanContext() {
    return toLogRecordData().getSpanContext();

Review comment (suggestion):
This isn't present on `ReadableSpan`. If we add it here, we should minimally open an issue to make sure we add to `ReadableSpan` in a followup.

Code after:
  @SuppressWarnings("unchecked")
  default ReadWriteLogRecord setAllAttributes(Attributes attributes) {
    if (attributes == null || attributes.isEmpty()) {
      return this;
    }
    attributes.forEach(
        (attributeKey, value) -> this.setAttribute((AttributeKey<Object>) attributeKey, value));
    return this;
  }

  /** Return an immutable {@link LogRecordData} instance representing this log record. */
  LogRecordData toLogRecordData();

  /**
   * Returns the value of a given attribute if it exists. This is the equivalent of calling
   * getAttributes().get(key)
   */
  @Nullable
  default <T> T getAttribute(AttributeKey<T> key) {
    return toLogRecordData().getAttributes().get(key);
  }

  /** Returns the instrumentation scope that generated this log. */
  default InstrumentationScopeInfo getInstrumentationScopeInfo() {
    return toLogRecordData().getInstrumentationScopeInfo();
  }

  /** Returns the timestamp at which the log record occurred, in epoch nanos. */
  default long getTimestampEpochNanos() {
    return toLogRecordData().getTimestampEpochNanos();
  }

  /** Returns the timestamp at which the log record was observed, in epoch nanos. */
  default long getObservedTimestampEpochNanos() {
    return toLogRecordData().getTimestampEpochNanos();
  }

  /** Return the span context for this log, or {@link SpanContext#getInvalid()} if unset. */
  default SpanContext getSpanContext() {
    return toLogRecordData().getSpanContext();
  }

  /** Returns the severity for this log, or {@link Severity#UNDEFINED_SEVERITY_NUMBER} if unset. */
  default Severity getSeverity() {
    return toLogRecordData().getSeverity();
  }

  /** Returns the severity text for this log, or null if unset. */
  @Nullable
  default String getSeverityText() {
    return toLogRecordData().getSeverityText();