-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventHookSpanBuilder.cs
85 lines (71 loc) · 2.9 KB
/
EventHookSpanBuilder.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
namespace OpenTracing.Contrib.EventHookTracer
{
using System;
using JetBrains.Annotations;
internal sealed class EventHookSpanBuilder : ISpanBuilder
{
[NotNull] private readonly EventHookTracer tracer;
private readonly ISpanBuilder impl;
public EventHookSpanBuilder([NotNull] ISpanBuilder impl, [NotNull] EventHookTracer tracer)
{
this.impl = impl;
this.tracer = tracer;
}
public ISpanBuilder AsChildOf(ISpanContext parent)
{
ISpanBuilder builder = this.impl.AsChildOf(parent);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder AsChildOf(ISpan parent)
{
ISpanBuilder builder = this.impl.AsChildOf(parent);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder AddReference(string referenceType, ISpanContext referencedContext)
{
ISpanBuilder builder = this.impl.AddReference(referenceType, referencedContext);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder IgnoreActiveSpan()
{
ISpanBuilder builder = this.impl.IgnoreActiveSpan();
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder WithTag(string key, string value)
{
ISpanBuilder builder = this.impl.WithTag(key, value);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder WithTag(string key, bool value)
{
ISpanBuilder builder = this.impl.WithTag(key, value);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder WithTag(string key, int value)
{
ISpanBuilder builder = this.impl.WithTag(key, value);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder WithTag(string key, double value)
{
ISpanBuilder builder = this.impl.WithTag(key, value);
return new EventHookSpanBuilder(builder, this.tracer);
}
public ISpanBuilder WithStartTimestamp(DateTimeOffset timestamp)
{
ISpanBuilder builder = this.impl.WithStartTimestamp(timestamp);
return new EventHookSpanBuilder(builder, this.tracer);
}
public IScope StartActive(bool finishSpanOnDispose)
{
// Cannot call this.impl.StartActive(finishSpanOnDispose) directly due to the lack
// of exposing of finishSpanOnDispose in IScope (see EventHookScopeManager for details)
return this.tracer.ScopeManager.Activate(this.impl.Start(), finishSpanOnDispose);
}
public ISpan Start()
{
ISpan span = this.impl.Start();
return new EventHookSpan(span, this.tracer);
}
}
}