public interface IDistributedTracePayload
Provides access to distributed trace payload.
Requirements
Description
Provides access to distributed trace payload.
Methods
Name | Description |
---|---|
HttpSafe() | Returns a serialized, Base64-encoded version of the distributed trace payload. |
Text() | Returns a serialized, plain text version of the distributed trace payload. |
IsEmpty() | Returns true if the distributed trace payload is empty, false if it is not. This method is provided as a convenience method and to emphasize that it is possible the .NET agent will create an empty payload. |
Example(s)
HttpSafe()
KeyValuePair<string, string> metadata; IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent(); ITransaction transaction = agent.CurrentTransaction; IDistributedTracePayload payload = transaction.CreateDistributedTracePayload(); metadata.Key = NewRelic.Api.Agent.Constants.DistributedTracePayloadKey; metadata.Value = payload.HttpSafe();
Text()
KeyValuePair<string, string> metadata; IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent(); ITransaction transaction = agent.CurrentTransaction; IDistributedTracePayload payload = transaction.CreateDistributedTracePayload(); metadata.Key = NewRelic.Api.Agent.Constants.DistributedTracePayloadKey; metadata.Value = payload.Text();
IsEmpty()
KeyValuePair<string, string> metadata; IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent(); ITransaction transaction = agent.CurrentTransaction; IDistributedTracePayload payload = transaction.CreateDistributedTracePayload(); if (!payload.IsEmpty()) { metadata.Key = NewRelic.Api.Agent.Constants.DistributedTracePayloadKey; metadata.Value = payload.HttpSafe(); }