dotnet / dotnet/extensions

[API Proposal]: Consider capturing ActivitySpanId, ActivityTraceId, and MessageTemplate when using log buffering

Open
#6,502 2 comments 3 reactions 1 assignee Claimed by @evgenyfedorov2 View on GitHub
api-suggestion area-telemetry untriaged
Dominant language
C#
Stars
3.2k
Forks
894
Avg merge
1d 12h
Merged PRs (30d)
23

Description

### Background and motivation

Here's what docs say:
> Not all information of the original log record is preserved. Log buffering internally uses BufferedLogRecord class when flushing, and the following of its properties are always empty:
`ActivitySpanId`, `ActivityTraceId`, `ManagedThreadId`, `MessageTemplate`.

Maybe I am missing a point with log buffering, but I believe knowing the trace and span ids is still useful for correlating messages with traces.
`MessageTemplate` is convenient for indexing and searching for similar messages. But it can increase memory footprint, so not sure about it for 100%.

### API Proposal

`BufferedLogRecord` already has these properties, but [`SerializedLogRecord`](https://github.com/dotnet/extensions/blob/04bd58871e6dd4dfd2fbcf5f0365c89d2466fffe/src/Shared/LogBuffering/SerializedLogRecord.cs#L16) stored in buffer does not. It looks like these properties should be added there.

### API Usage

Should be transparent for the client.

### Alternative Designs

_No response_

### Risks

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.