Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateActivity() [2/4]

Activity System.Diagnostics.ActivitySource.CreateActivity ( string name,
ActivityKind kind,
ActivityContext context,
string parentId,
IEnumerable< KeyValuePair< string, object > > tags,
IEnumerable< ActivityLink > links,
DateTimeOffset startTime,
bool startIt = true,
ActivityIdFormat idFormat = ActivityIdFormat::Unknown )
inlineprivate

Definition at line 93 of file ActivitySource.cs.

94 {
96 if (listeners == null || listeners.Count == 0)
97 {
98 return null;
99 }
100 Activity result2 = null;
102 ActivityTagsCollection activityTagsCollection;
103 if (parentId != null)
104 {
108 if (activityCreationOptions.IdFormat == ActivityIdFormat.W3C)
109 {
111 }
113 {
114 SampleActivity<string> sampleUsingParentId = listener.SampleUsingParentId;
115 if (sampleUsingParentId != null)
116 {
118 if (activitySamplingResult2 > result)
119 {
121 }
122 }
123 else if (data.IdFormat == ActivityIdFormat.W3C)
124 {
126 if (sample2 != null)
127 {
129 if (activitySamplingResult3 > result)
130 {
132 }
133 }
134 }
136 if (context == default(ActivityContext))
137 {
138 if (activityCreationOptions.GetContext() != default(ActivityContext))
139 {
140 context = activityCreationOptions.GetContext();
141 parentId = null;
142 }
143 else if (dataWithContext2.GetContext() != default(ActivityContext))
144 {
145 context = dataWithContext2.GetContext();
146 parentId = null;
147 }
148 }
150 ActivityTagsCollection samplingTags = dataWithContext2.GetSamplingTags();
151 if (samplingTags != null)
152 {
153 if (activityTagsCollection == null)
154 {
156 }
157 else
158 {
160 {
162 }
163 }
164 }
166 }
167 else
168 {
169 bool flag = context == default(ActivityContext) && Activity.Current != null;
170 ActivityCreationOptions<ActivityContext> data2 = new ActivityCreationOptions<ActivityContext>(this, name, flag ? Activity.Current.Context : context, kind, tags, links, idFormat);
172 {
173 SampleActivity<ActivityContext> sample = listener.Sample;
174 if (sample != null)
175 {
177 if (activitySamplingResult > result)
178 {
179 result = activitySamplingResult;
180 }
181 }
182 }, ref data2, ref samplingResult, ref data2);
183 if (!flag)
184 {
185 context = data2.GetContext();
186 }
187 activityTagsCollection = data2.GetSamplingTags();
188 idFormat = data2.IdFormat;
189 }
190 if (samplingResult != 0)
191 {
192 result2 = Activity.Create(this, name, kind, parentId, context, tags, links, startTime, activityTagsCollection, samplingResult, startIt, idFormat);
193 }
194 return result2;
195 }
void Add(TKey key, TValue value)
SynchronizedList< ActivityListener > _listeners

References System.Diagnostics.ActivitySource._listeners, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Diagnostics.Activity.Create(), System.Diagnostics.Activity.Current, System.item, System.Diagnostics.ActivityListener.Sample, and System.Diagnostics.ActivityListener.SampleUsingParentId.