Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[onecollector] Remove ext.dt.traceFlags #1345

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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