/
TransactionContext.cs
51 lines (46 loc) · 1.56 KB
/
TransactionContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
namespace Sentry;
/// <summary>
/// Transaction metadata used for sampling.
/// </summary>
public class TransactionContext : SpanContext, ITransactionContext
{
/// <inheritdoc />
public string Name { get; set; }
/// <inheritdoc />
public TransactionNameSource NameSource { get; set; }
/// <summary>
/// Whether the parent transaction of this transaction has been sampled.
/// </summary>
public bool? IsParentSampled { get; }
/// <summary>
/// Initializes an instance of <see cref="TransactionContext"/>.
/// </summary>
public TransactionContext(
string name,
string operation,
SpanId? spanId = null,
SpanId? parentSpanId = null,
SentryId? traceId = null,
string? description = "",
SpanStatus? status = null,
bool? isSampled = null,
bool? isParentSampled = null,
TransactionNameSource nameSource = TransactionNameSource.Custom
)
: base(operation, spanId, parentSpanId, traceId, description, status, isSampled)
{
Name = name;
IsParentSampled = isParentSampled;
NameSource = nameSource;
}
/// <summary>
/// Initializes an instance of <see cref="TransactionContext"/>.
/// </summary>
internal TransactionContext(
string name,
string operation,
SentryTraceHeader traceHeader)
: this(name, operation, SpanId.Create(), parentSpanId: traceHeader.SpanId, traceId: traceHeader.TraceId, "", null, isSampled: traceHeader.IsSampled, isParentSampled: traceHeader.IsSampled)
{
}
}