Syntax
NewRelic.Api.Agent.TraceMetadata;
Returns properties in the current execution environment used to support tracing.
Requirements
Agent version 8.19 or higher.
Compatible with all app types.
Distributed tracing must be enabled to get meaningful values.
Description
Provides access to the following properties:
Properties
Name | Description |
---|---|
| Returns a string representing the currently executing trace. If the trace ID is not available, or distributed tracing is disabled, the value will be |
| Returns a string representing the currently executing span. If the span ID is not available, or distributed tracing is disabled, the value will be |
| Returns |
Examples
IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent();TraceMetadata traceMetadata = agent.TraceMetadata;string traceId = traceMetadata.TraceId;string spanId = traceMetadata.SpanId;bool isSampled = traceMetadata.IsSampled;