Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,14 @@ protected void ConfigureSpanContext(SpanContextConfigActionWithPreviousConfig? c
var prev = SpanContextConfig;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this line be kept? It seems a bit harder to read when SpanContextConfig is set to an expression that uses the previous value of SpanContentConfig?

SpanContextConfig = config == null
? null
: ((SpanEditHandlerBuilder? span, ref ISpanChunkGenerator? chunkGenerator) => config(span, ref chunkGenerator, prev));
: GetNewSpanContextConfigAction(config, prev);
InitializeContext();

// Separated into it's own method to avoid closure allocations when not being called
static SpanContextConfigAction GetNewSpanContextConfigAction(SpanContextConfigActionWithPreviousConfig config, SpanContextConfigAction? prev)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is uncommon enough that it I think it probably warrants a comment that it needed to avoid allocations.

{
return (span, ref chunkGenerator) => config(span, ref chunkGenerator, prev);
}
}

protected void InitializeContext()
Expand Down