ITransaction

public interface ITransaction
Provides access to transaction-specific methods in the New Relic API.

Requirements

Agent version 8.9 or higher.

Compatible with all app types.

Description

Provides access to transaction-specific methods in the New Relic .NET agent API. To obtain a reference to ITransaction, use the current transaction method available on IAgent.

Methods

Name Description
AcceptDistributedTracePayload(string, TransportType) Accepts an incoming distributed trace payload from another service. The payload can be a Base64-encoded or plain text string. Distributed tracing must be enabled.
CreateDistributedTracePayload() Creates a distributed trace payload for inclusion in an outgoing request. The payload can be accessed using the returned IDistributedTracePayload interface. Distributed tracing must be enabled.

Parameters

These are parameters for AcceptDistributedTracePayload:

Parameter Description

$payload

string

Required. A string representation of the incoming distributed trace payload.

$TransportType

enum

Optional, but recommended. An enum value describing the transport of the incoming payload (e.g. http). Default is TransportType.Unknown.

Example(s)

AcceptDistributedTracePayload(string, TransportType)

KeyValuePair<string, string> metadata;
IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent();
ITransaction transaction = agent.CurrentTransaction;
transaction.AcceptDistributedTracePayload(metadata.Value, TransportType.Queue);

CreateDistributedTracePayload()

IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent();
ITransaction transaction = agent.CurrentTransaction;
IDistributedTracePayload payload = transaction.CreateDistributedTracePayload();

For more help

Recommendations for learning more: