ChatCompletionActivityMode
NexusLabs.Foundry.MicrosoftAgentFramework¶
NexusLabs.Foundry.MicrosoftAgentFramework.Diagnostics¶
ChatCompletionActivityMode Enum¶
Controls how Foundry's diagnostics middleware creates System.Diagnostics.Activity spans for chat completion calls.
Fields¶
Always 0
Always create a Foundry agent.chat activity, regardless of whether
a parent gen_ai.* activity already exists. This is the default and
is appropriate when Foundry is the only OTel instrumentation layer.
EnrichParent 1
When a parent System.Diagnostics.Activity with a
gen_ai.-prefixed operation name exists (from MEAI's
UseOpenTelemetry() or MAF's WithOpenTelemetry()), add
Foundry-specific tags to that activity instead of creating a new one.
When no such parent exists, create the activity as normal.
Remarks¶
Use this mode when both Foundry diagnostics and upstream OTel middleware are active to avoid duplicate spans for the same chat completion call. Metrics (counters, histograms) and in-process diagnostics recording are unaffected — only the System.Diagnostics.Activity creation is suppressed.