Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### SDK

#### Exporters

* OTLP: Fix sign extension of `LogRecord` flags in the low-allocation log marshaler

## Version 1.63.0 (2026-06-05)

### API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void writeTo(Serializer output, LogRecordData log, MarshalerContext conte
log.getTotalAttributeCount() - log.getAttributes().size());

SpanContext spanContext = log.getSpanContext();
output.serializeFixed32(LogRecord.FLAGS, spanContext.getTraceFlags().asByte());
output.serializeByteAsFixed32(LogRecord.FLAGS, spanContext.getTraceFlags().asByte());
if (!spanContext.getTraceId().equals(INVALID_TRACE_ID)) {
output.serializeTraceId(LogRecord.TRACE_ID, spanContext.getTraceId(), context);
}
Expand Down Expand Up @@ -91,7 +91,7 @@ public int getBinarySerializedSize(LogRecordData log, MarshalerContext context)
size += MarshalerUtil.sizeUInt32(LogRecord.DROPPED_ATTRIBUTES_COUNT, droppedAttributesCount);

SpanContext spanContext = log.getSpanContext();
size += MarshalerUtil.sizeFixed32(LogRecord.FLAGS, spanContext.getTraceFlags().asByte());
size += MarshalerUtil.sizeByteAsFixed32(LogRecord.FLAGS, spanContext.getTraceFlags().asByte());
if (!spanContext.getTraceId().equals(INVALID_TRACE_ID)) {
size += MarshalerUtil.sizeTraceId(LogRecord.TRACE_ID, spanContext.getTraceId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ class LowAllocationLogRequestMarshalerTest {
InstrumentationScopeInfo.create("name");
private static final String TRACE_ID = "7b2e170db4df2d593ddb4ddf2ddf2d59";
private static final String SPAN_ID = "170d3ddb4d23e81f";
// Use a trace flags value with the high bit set (0x80) so the relative comparisons below catch
// sign extension of the byte flags into the OTLP fixed32 field. With a low value like 0x01 the
// sign-extension bug would be hidden.
private static final SpanContext SPAN_CONTEXT =
SpanContext.create(TRACE_ID, SPAN_ID, TraceFlags.getSampled(), TraceState.getDefault());
SpanContext.create(
TRACE_ID, SPAN_ID, TraceFlags.fromByte((byte) 0x80), TraceState.getDefault());

private final List<LogRecordData> logRecordDataList = createLogRecordDataList();

Expand Down
Loading