Skip to content

Commit 6548470

Browse files
committed
OTLP logs proto doesn't include the remote trace flag
1 parent b8e2999 commit 6548470

2 files changed

Lines changed: 3 additions & 41 deletions

File tree

dd-trace-core/src/main/java/datadog/trace/core/otlp/logs/OtlpLogsProto.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import static datadog.trace.core.otlp.common.OtlpCommonProto.writeString;
1313
import static datadog.trace.core.otlp.common.OtlpCommonProto.writeTag;
1414
import static datadog.trace.core.otlp.common.OtlpCommonProto.writeVarInt;
15-
import static datadog.trace.core.otlp.trace.OtlpTraceProto.NO_TRACE_FLAGS;
16-
import static datadog.trace.core.otlp.trace.OtlpTraceProto.REMOTE_TRACE_FLAG;
1715
import static datadog.trace.core.otlp.trace.OtlpTraceProto.SAMPLED_TRACE_FLAG;
1816
import static datadog.trace.core.otlp.trace.OtlpTraceProto.writeSpanId;
1917
import static datadog.trace.core.otlp.trace.OtlpTraceProto.writeTraceId;
@@ -76,16 +74,9 @@ public static byte[] recordLogRecordMessage(GrowableBuffer buf, OtlpLogRecord lo
7674
writeTag(buf, 10, LEN_WIRE_TYPE);
7775
writeSpanId(buf, logRecord.spanContext.getSpanId());
7876

79-
int traceFlags = NO_TRACE_FLAGS;
8077
if (logRecord.spanContext.getSamplingPriority() > 0) {
81-
traceFlags |= SAMPLED_TRACE_FLAG;
82-
}
83-
if (logRecord.spanContext.isRemote()) {
84-
traceFlags |= REMOTE_TRACE_FLAG;
85-
}
86-
if (traceFlags != NO_TRACE_FLAGS) {
8778
writeTag(buf, 8, I32_WIRE_TYPE);
88-
writeI32(buf, traceFlags);
79+
writeI32(buf, SAMPLED_TRACE_FLAG);
8980
}
9081
}
9182

dd-trace-core/src/test/java/datadog/trace/core/otlp/logs/OtlpLogsProtoTest.java

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static datadog.trace.bootstrap.otlp.common.OtlpAttributeVisitor.DOUBLE_ATTRIBUTE;
55
import static datadog.trace.bootstrap.otlp.common.OtlpAttributeVisitor.LONG_ATTRIBUTE;
66
import static datadog.trace.bootstrap.otlp.common.OtlpAttributeVisitor.STRING_ATTRIBUTE;
7-
import static datadog.trace.core.otlp.trace.OtlpTraceProto.REMOTE_TRACE_FLAG;
87
import static datadog.trace.core.otlp.trace.OtlpTraceProto.SAMPLED_TRACE_FLAG;
98
import static java.util.Arrays.asList;
109
import static java.util.Collections.emptyList;
@@ -116,12 +115,6 @@ static final class LogSpec {
116115
/** event_name (proto field 12); {@code null} → field absent. */
117116
@Nullable final String eventName;
118117

119-
/**
120-
* If true, wraps the span's IDs in a remote {@link ExtractedContext} so that {@code isRemote()}
121-
* returns true, setting {@code REMOTE_TRACE_FLAG}.
122-
*/
123-
boolean useRemoteContext;
124-
125118
/**
126119
* If true, the span at {@code spanContextIndex} is started under a known 128-bit trace ID so
127120
* the high-order bytes of trace_id are non-zero.
@@ -149,11 +142,6 @@ static final class LogSpec {
149142
this.eventName = eventName;
150143
}
151144

152-
LogSpec remoteContext() {
153-
this.useRemoteContext = true;
154-
return this;
155-
}
156-
157145
LogSpec use128BitTraceId() {
158146
this.use128BitTraceId = true;
159147
return this;
@@ -298,9 +286,6 @@ static Stream<Arguments> cases() {
298286
Arguments.of(
299287
"log with 128-bit trace ID — high-order trace_id bytes non-zero",
300288
asList(contextLog("128-bit trace", 0).use128BitTraceId())),
301-
Arguments.of(
302-
"log with remote span context — REMOTE flag set in flags field",
303-
asList(contextLog("remote context", 0).remoteContext())),
304289

305290
// ── event name ────────────────────────────────────────────────────────
306291
Arguments.of(
@@ -487,24 +472,15 @@ private static List<DDSpan> buildSpans(List<LogSpec> specs) {
487472
}
488473

489474
/**
490-
* Resolves the {@link AgentSpanContext} for a spec: null if no context, remote {@link
491-
* ExtractedContext} if {@code useRemoteContext}, or the span's own context otherwise.
475+
* Resolves the {@link AgentSpanContext} for a spec: the span's own context, or null if no
476+
* context.
492477
*/
493478
@Nullable
494479
private static AgentSpanContext resolveContext(List<DDSpan> spans, LogSpec spec) {
495480
if (spec.spanContextIndex < 0) {
496481
return null;
497482
}
498483
DDSpan span = spans.get(spec.spanContextIndex);
499-
if (spec.useRemoteContext) {
500-
return new ExtractedContext(
501-
span.getTraceId(),
502-
span.getSpanId(),
503-
PrioritySampling.USER_KEEP,
504-
null,
505-
PropagationTags.factory().empty(),
506-
TracePropagationStyle.DATADOG);
507-
}
508484
return span.context();
509485
}
510486

@@ -718,11 +694,6 @@ private static void verifyLogRecord(
718694
(parsedFlags & SAMPLED_TRACE_FLAG) != 0,
719695
"SAMPLED flag must be set in flags [" + caseName + "]");
720696
}
721-
if (ctx.isRemote()) {
722-
assertTrue(
723-
(parsedFlags & REMOTE_TRACE_FLAG) != 0,
724-
"REMOTE flag must be set in flags [" + caseName + "]");
725-
}
726697
if (spec.use128BitTraceId) {
727698
long highOrderBytes = readBigEndianLong(parsedTraceId);
728699
assertNotEquals(

0 commit comments

Comments
 (0)