• /
  • ログイン

IDistributedTracePayload (.NET agent API)

Syntax

public interface IDistributedTracePayload

Provides access to distributed trace payload.

Requirements

Agent version 8.9 or higher.

Compatible with all app types.

Distributed tracing must be enabled.

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.

Examples

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();
}

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.