Skip to content

Commit

Permalink
[onecollector] Remove ext.dt.traceFlags (#1345)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch committed Sep 11, 2023
1 parent c4784de commit 630667b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
`{OriginalFormat}` key or `LogRecord.Body`).
([#1321](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1321))

* Removed `traceFlags` from the common schema `dt` (Distributed Tracing)
extension because it is not currently supported by the OneCollector service.
([#1345](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1345))

## 1.5.1

Released 2023-Aug-07
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ internal sealed class LogRecordCommonSchemaJsonSerializer : CommonSchemaJsonSeri
private static readonly JsonEncodedText DistributedTraceExtensionProperty = JsonEncodedText.Encode("dt");
private static readonly JsonEncodedText DistributedTraceExtensionTraceIdProperty = JsonEncodedText.Encode("traceId");
private static readonly JsonEncodedText DistributedTraceExtensionSpanIdProperty = JsonEncodedText.Encode("spanId");
private static readonly JsonEncodedText DistributedTraceExtensionTraceFlagsProperty = JsonEncodedText.Encode("traceFlags");
private static readonly JsonEncodedText ExceptionExtensionProperty = JsonEncodedText.Encode("ex");
private static readonly JsonEncodedText ExceptionExtensionTypeProperty = JsonEncodedText.Encode("type");
private static readonly JsonEncodedText ExceptionExtensionMessageProperty = JsonEncodedText.Encode("msg");
Expand Down Expand Up @@ -215,7 +214,12 @@ private void SerializeExtensionPropertiesToJson(LogRecord item, Utf8JsonWriter w
writer.WriteStartObject(DistributedTraceExtensionProperty);
writer.WriteString(DistributedTraceExtensionTraceIdProperty, item.TraceId.ToHexString());
writer.WriteString(DistributedTraceExtensionSpanIdProperty, item.SpanId.ToHexString());
writer.WriteNumber(DistributedTraceExtensionTraceFlagsProperty, (int)item.TraceFlags);
/*
* Note: OneCollector does not currently support traceFlags. See:
* https://github.com/open-telemetry/opentelemetry-dotnet-contrib/issues/1313
*
* writer.WriteNumber(DistributedTraceExtensionTraceFlagsProperty, (int)item.TraceFlags);
*/
writer.WriteEndObject();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void LogRecordTraceContextJsonTest()
});

Assert.Equal(
$"{{\"ver\":\"4.0\",\"name\":\"Namespace.Name\",\"time\":\"2032-01-18T10:11:12Z\",\"iKey\":\"o:tenant-token\",\"data\":{{\"severityText\":\"Trace\",\"severityNumber\":1}},\"ext\":{{\"dt\":{{\"traceId\":\"{traceId}\",\"spanId\":\"{spanId}\",\"traceFlags\":1}}}}}}\n",
$"{{\"ver\":\"4.0\",\"name\":\"Namespace.Name\",\"time\":\"2032-01-18T10:11:12Z\",\"iKey\":\"o:tenant-token\",\"data\":{{\"severityText\":\"Trace\",\"severityNumber\":1}},\"ext\":{{\"dt\":{{\"traceId\":\"{traceId}\",\"spanId\":\"{spanId}\"}}}}}}\n",
json);
}

Expand Down

0 comments on commit 630667b

Please sign in to comment.