RehanSaeed / Serilog.Enrichers.Span

Enrich Serilog log events with properties from Open Telemetry spans.
MIT License
96 stars 19 forks source link

Allow setting custom values for SpanId, TraceId and ParentId #28

Closed evilpilaf closed 2 years ago

evilpilaf commented 3 years ago

Currently the enricher sets properties of SpanId TraceId and ParentId but it'd be great if we can override it to what we want to comply with OTEL and OTLP, e.g. trace.span_id trace.trace_id trace.parent_id

RehanSaeed commented 3 years ago

Hey @evilpilaf, do you have more info/links about these names that you'd like to rename them to? Are these part of a standard? Should these be the default?

I get that you want to be able to set the names yourself, just wondering if there is some Open Telemetry standard that we should be conforming to.

evilpilaf commented 3 years ago

After a lot of digging because I could not find this info in the official documentation and semantic conventions, I could find that in the .proto file for traces we can see these fields https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto

evilpilaf commented 3 years ago

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/overview.md#semantic-conventions.md

RehanSaeed commented 3 years ago

I don't see where trace.span_id is defined in that document. After a cursory search, I also couldn't find anything definitive. Would it be worth raising an issue in the Open Telemetry specification repo to determine the naming here?

Insomniak47 commented 2 years ago

Alternatively just the ability to rename them would also be nice. We're using this enricher but it doesn't really place nicely with datadog and it's correlation. Ideally we'd be able to do it on the dd ingest but that doesn't seem to be working so it'd be nice to override the keys used.

RehanSaeed commented 2 years ago

Seems reasonable, would take a PR for it.

Insomniak47 commented 2 years ago

@RehanSaeed sounds good I'll see if I can work it into our next sprint.

diogocp commented 2 years ago

The current names already follow the OpenTelemetry Log Data Model, at least for TraceId and SpanId (ParentId is not specified).

RehanSaeed commented 2 years ago

This was released in https://github.com/RehanSaeed/Serilog.Enrichers.Span/releases/tag/2.1.0.