Skip to content

Commit 40f4180

Browse files
authored
Automatic port of System.Diagnostics.Activity* docs (#4773)
* ExcludeFromCodeCoverageAttribute * ActivityTagsCollection * ActivityTagsCollection+Enumerator * ActivitySource * ActivityListener * ActivityLink * ActivityEvent * ActivityCreationOptions`1 * ActivityContext * Activity * ActivityKind * Address suggestions * Move remark * Update xml/System.Diagnostics/ActivityContext.xml * fix xref * Apply suggestions from code review * fix xrefs * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: carlossanlop <[email protected]>
1 parent 642f382 commit 40f4180

11 files changed

+332
-201
lines changed

xml/System.Diagnostics.CodeAnalysis/ExcludeFromCodeCoverageAttribute.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<ReturnType>System.String</ReturnType>
117117
</ReturnValue>
118118
<Docs>
119-
<summary>To be added.</summary>
119+
<summary>Gets or sets the justification for excluding the member from code coverage.</summary>
120120
<value>To be added.</value>
121121
<remarks>To be added.</remarks>
122122
</Docs>

xml/System.Diagnostics/Activity.xml

Lines changed: 91 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ This key/value pair is included in the collection returned by the <xref:System.D
168168
<Parameter Name="e" Type="System.Diagnostics.ActivityEvent" Index="0" FrameworkAlternate="net-5.0" />
169169
</Parameters>
170170
<Docs>
171-
<param name="e">To be added.</param>
172-
<summary>To be added.</summary>
173-
<returns>To be added.</returns>
171+
<param name="e">The activity event to add.</param>
172+
<summary>Adds the specified activity event to the events list.</summary>
173+
<returns><see langword="this" /> for convenient chaining.</returns>
174174
<remarks>To be added.</remarks>
175175
</Docs>
176176
</Member>
@@ -194,11 +194,19 @@ This key/value pair is included in the collection returned by the <xref:System.D
194194
<Parameter Name="value" Type="System.Object" Index="1" FrameworkAlternate="net-5.0" />
195195
</Parameters>
196196
<Docs>
197-
<param name="key">To be added.</param>
198-
<param name="value">To be added.</param>
199-
<summary>To be added.</summary>
200-
<returns>To be added.</returns>
201-
<remarks>To be added.</remarks>
197+
<param name="key">The tag key name.</param>
198+
<param name="value">The tag value mapped to the input key.</param>
199+
<summary>Updates the activity to have a tag with an additional <paramref name="key" /> and <paramref name="value" />.</summary>
200+
<returns><see langword="this" /> for convenient chaining.</returns>
201+
<remarks>
202+
<format type="text/markdown"><![CDATA[
203+
204+
## Remarks
205+
206+
This shows up in the <xref:System.Diagnostics.Activity.TagObjects> enumeration. It is meant for information that is useful to log but not needed for runtime control (for the latter, <xref:System.Diagnostics.Activity.Baggage>).
207+
208+
]]></format>
209+
</remarks>
202210
</Docs>
203211
</Member>
204212
<Member MemberName="AddTag">
@@ -233,13 +241,14 @@ This key/value pair is included in the collection returned by the <xref:System.D
233241
<returns>
234242
<see langword="this" /> for convenient chaining.</returns>
235243
<remarks>
236-
<format type="text/markdown"><![CDATA[
244+
<format type="text/markdown">
245+
<![CDATA[
237246
238247
## Remarks
239248
240-
This key/value pair is included in the collection returned by the <xref:System.Diagnostics.Activity.Tags> property.
249+
This key/value pair is included in the collection returned by the <xref:System.Diagnostics.Activity.Tags> or <xref:System.Diagnostics.Activity.TagObjects> property.
241250
242-
<xref:System.Diagnostics.Activity.Tags> is meant for information that is useful to log with the <xref:System.Diagnostics.Activity>. For information that's needed for runtime control, use the <xref:System.Diagnostics.Activity.Baggage> property.
251+
<xref:System.Diagnostics.Activity.Tags> <xref:System.Diagnostics.Activity.TagObjects> are meant for information that is useful to log with the <xref:System.Diagnostics.Activity>. For information that's needed for runtime control, use the <xref:System.Diagnostics.Activity.Baggage> property.
243252
244253
]]></format>
245254
</remarks>
@@ -296,8 +305,8 @@ This key/value pair is included in the collection returned by the <xref:System.D
296305
<ReturnType>System.Diagnostics.ActivityContext</ReturnType>
297306
</ReturnValue>
298307
<Docs>
299-
<summary>To be added.</summary>
300-
<value>To be added.</value>
308+
<summary>Gets the context of the activity. Context becomes valid only if the activity has been started.</summary>
309+
<value>The context of the activity, if the activity has been started; otherwise, returns the default context.</value>
301310
<remarks>To be added.</remarks>
302311
</Docs>
303312
</Member>
@@ -379,9 +388,19 @@ In .NET 5.0 and later, the default format is <xref:System.Diagnostics.ActivityId
379388
<ReturnType>System.String</ReturnType>
380389
</ReturnValue>
381390
<Docs>
382-
<summary>To be added.</summary>
383-
<value>To be added.</value>
384-
<remarks>To be added.</remarks>
391+
<summary>Gets or sets the display name of the activity.</summary>
392+
<value>A string that represents the activity display name.</value>
393+
<remarks>
394+
<format type="text/markdown"><![CDATA[
395+
396+
## Remarks
397+
398+
`DisplayName` is intended to be used in a user interface and need not be the same as `OperationName`.
399+
400+
If the `DisplayName` property is not set, it will return the same value as `OperationName`.
401+
402+
]]></format>
403+
</remarks>
385404
</Docs>
386405
</Member>
387406
<Member MemberName="Dispose">
@@ -404,7 +423,7 @@ In .NET 5.0 and later, the default format is <xref:System.Diagnostics.ActivityId
404423
</ReturnValue>
405424
<Parameters />
406425
<Docs>
407-
<summary>To be added.</summary>
426+
<summary>Stops the activity if it is already started and notifies any event listeners. Nothing will happen otherwise.</summary>
408427
<remarks>To be added.</remarks>
409428
</Docs>
410429
</Member>
@@ -474,8 +493,8 @@ In .NET 5.0 and later, the default format is <xref:System.Diagnostics.ActivityId
474493
<ReturnType>System.Collections.Generic.IEnumerable&lt;System.Diagnostics.ActivityEvent&gt;</ReturnType>
475494
</ReturnValue>
476495
<Docs>
477-
<summary>To be added.</summary>
478-
<value>To be added.</value>
496+
<summary>Gets the list of all the activity events attached to this activity.</summary>
497+
<value>An enumeration of activity events attached to this activity. If the activity has no events, returns an empty enumeration.</value>
479498
<remarks>To be added.</remarks>
480499
</Docs>
481500
</Member>
@@ -559,9 +578,9 @@ Normally if the <xref:System.Diagnostics.Activity.ParentId> is defined, its form
559578
<Parameter Name="propertyName" Type="System.String" Index="0" FrameworkAlternate="net-5.0" />
560579
</Parameters>
561580
<Docs>
562-
<param name="propertyName">To be added.</param>
563-
<summary>To be added.</summary>
564-
<returns>To be added.</returns>
581+
<param name="propertyName">The name associated to the object.</param>
582+
<summary>Returns the object mapped to the specified property name.</summary>
583+
<returns>The object mapped to the property name, if one is found; otherwise, <see langword="null" />.</returns>
565584
<remarks>To be added.</remarks>
566585
</Docs>
567586
</Member>
@@ -639,9 +658,18 @@ An ID has a hierarchical structure: `root-id.id1_id2.id3_`. The ID is generated
639658
<ReturnType>System.Boolean</ReturnType>
640659
</ReturnValue>
641660
<Docs>
642-
<summary>To be added.</summary>
643-
<value>To be added.</value>
644-
<remarks>To be added.</remarks>
661+
<summary>Indicates if the this activity should be populated with all the propagation information, as well as all the other properties such as links, tags and events.</summary>
662+
<value>
663+
<see langword="true" /> if the activity should be populated; <see langword="false" /> otherwise.</value>
664+
<remarks>
665+
<format type="text/markdown"><![CDATA[
666+
667+
## Remarks
668+
669+
The best practice for the library authors is not try to set this property. This property is automatically set when creating the Activity. The setter is useful only in the case of Activity objects created using the Activity constructor and want to override the default value. Activity objects created using <xref:System.Diagnostics.ActivitySource.StartActivity%2A> automatically have this property set to the right value.
670+
671+
]]></format>
672+
</remarks>
645673
</Docs>
646674
</Member>
647675
<Member MemberName="Kind">
@@ -660,8 +688,8 @@ An ID has a hierarchical structure: `root-id.id1_id2.id3_`. The ID is generated
660688
<ReturnType>System.Diagnostics.ActivityKind</ReturnType>
661689
</ReturnValue>
662690
<Docs>
663-
<summary>To be added.</summary>
664-
<value>To be added.</value>
691+
<summary>Gets the relationship between the activity, its parents, and its children in a trace.</summary>
692+
<value>One of the enumeration values that indicate relationship between the activity, its parents, and its children in a trace.</value>
665693
<remarks>To be added.</remarks>
666694
</Docs>
667695
</Member>
@@ -681,8 +709,8 @@ An ID has a hierarchical structure: `root-id.id1_id2.id3_`. The ID is generated
681709
<ReturnType>System.Collections.Generic.IEnumerable&lt;System.Diagnostics.ActivityLink&gt;</ReturnType>
682710
</ReturnValue>
683711
<Docs>
684-
<summary>To be added.</summary>
685-
<value>To be added.</value>
712+
<summary>Gets the list of all the activity links attached to this activity.</summary>
713+
<value>An enumeration of activity links attached to this activity. If the activity has no links, returns an empty enumeration.</value>
686714
<remarks>To be added.</remarks>
687715
</Docs>
688716
</Member>
@@ -892,9 +920,9 @@ The root ID is a substring from the <xref:System.Diagnostics.Activity.Id> or the
892920
<Parameter Name="propertyValue" Type="System.Object" Index="1" FrameworkAlternate="net-5.0" />
893921
</Parameters>
894922
<Docs>
895-
<param name="propertyName">To be added.</param>
896-
<param name="propertyValue">To be added.</param>
897-
<summary>To be added.</summary>
923+
<param name="propertyName">The name to associate the value with.</param>
924+
<param name="propertyValue">The object to attach and map to the property name.</param>
925+
<summary>Attaches any custom object to this activity. If the specified <paramref name="propertyName" /> was previously associated with another object, the property will be updated to be associated with the new <paramref name="propertyValue" /> instead. It is recommended to use a unique property name to avoid conflicts with anyone using the same value.</summary>
898926
<remarks>To be added.</remarks>
899927
</Docs>
900928
</Member>
@@ -1094,11 +1122,25 @@ This method has the advantage that no string manipulation is needed to set the I
10941122
<Parameter Name="value" Type="System.Object" Index="1" FrameworkAlternate="net-5.0" />
10951123
</Parameters>
10961124
<Docs>
1097-
<param name="key">To be added.</param>
1098-
<param name="value">To be added.</param>
1099-
<summary>To be added.</summary>
1100-
<returns>To be added.</returns>
1101-
<remarks>To be added.</remarks>
1125+
<param name="key">The tag key name.</param>
1126+
<param name="value">The tag value mapped to the input key.</param>
1127+
<summary>Adds or update the activity tag with the input key and value.</summary>
1128+
<returns><see langword="this" /> for convenient chaining.</returns>
1129+
<remarks>
1130+
<format type="text/markdown"><![CDATA[
1131+
1132+
## Remarks
1133+
1134+
1135+
- If the input value is `null`:
1136+
- If the collection has any tag with the same key, then this tag will get removed from the collection.
1137+
- Otherwise, nothing will happen and the collection will not change.
1138+
- If the input value is not `null`:
1139+
- If the collection has any tag with the same key, then the value mapped to this key will get updated with the new input value.
1140+
- Otherwise, the key and value will get added as a new tag to the collection.
1141+
1142+
]]></format>
1143+
</remarks>
11021144
</Docs>
11031145
</Member>
11041146
<Member MemberName="Source">
@@ -1117,9 +1159,17 @@ This method has the advantage that no string manipulation is needed to set the I
11171159
<ReturnType>System.Diagnostics.ActivitySource</ReturnType>
11181160
</ReturnValue>
11191161
<Docs>
1120-
<summary>To be added.</summary>
1162+
<summary>Get the activity source associated with this activity.</summary>
11211163
<value>To be added.</value>
1122-
<remarks>To be added.</remarks>
1164+
<remarks>
1165+
<format type="text/markdown"><![CDATA[
1166+
1167+
## Remarks
1168+
1169+
All activities created from public constructors will have a singleton source where the source name is an empty string. Otherwise, the source will hold the object that created the activity through <xref:System.Diagnostics.ActivitySource.StartActivity%2A>.
1170+
1171+
]]></format>
1172+
</remarks>
11231173
</Docs>
11241174
</Member>
11251175
<Member MemberName="SpanId">
@@ -1277,8 +1327,8 @@ Call <xref:System.Diagnostics.DiagnosticSource.StopActivity%2A?displayProperty=n
12771327
<ReturnType>System.Collections.Generic.IEnumerable&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.Object&gt;&gt;</ReturnType>
12781328
</ReturnValue>
12791329
<Docs>
1280-
<summary>To be added.</summary>
1281-
<value>To be added.</value>
1330+
<summary>Returns the list of tags representing information to log along with the activity. This information is not passed on to the children of this activity.</summary>
1331+
<value>A key-value pair enumeration of tags and objects.</value>
12821332
<remarks>To be added.</remarks>
12831333
</Docs>
12841334
</Member>

xml/System.Diagnostics/ActivityContext.xml

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@
1818
</Interface>
1919
</Interfaces>
2020
<Docs>
21-
<summary>To be added.</summary>
22-
<remarks>To be added.</remarks>
21+
<summary>A representation that conforms to the W3C TraceContext specification. It contains two identifiers: a TraceId and a SpanId, along with a set of common TraceFlags and system-specific TraceState values.</summary>
22+
<remarks>
23+
<format type="text/markdown"><![CDATA[
24+
25+
## Remarks
26+
27+
ActivityContext contains the property `IsRemote`, which is not part of W3C. `IsRemote` is indicating if the context is propagated from a remote parent.
28+
29+
]]></format>
30+
</remarks>
2331
</Docs>
2432
<Members>
2533
<Member MemberName=".ctor">
@@ -41,13 +49,21 @@
4149
<Parameter Name="isRemote" Type="System.Boolean" />
4250
</Parameters>
4351
<Docs>
44-
<param name="traceId">To be added.</param>
45-
<param name="spanId">To be added.</param>
46-
<param name="traceOptions">To be added.</param>
47-
<param name="traceState">To be added.</param>
48-
<param name="isRemote">To be added.</param>
49-
<summary>To be added.</summary>
50-
<remarks>To be added.</remarks>
52+
<param name="traceId">A trace identifier.</param>
53+
<param name="spanId">A span identifier.</param>
54+
<param name="traceOptions">An 8-bit field that controls tracing flags such as sampling, trace level, etc.</param>
55+
<param name="traceState">Carries system-specific configuration data.</param>
56+
<param name="isRemote">Indicates if the context is propagated from a remote parent.</param>
57+
<summary>Construct a new activity context instance using the specified arguments.</summary>
58+
<remarks>
59+
<format type="text/markdown"><![CDATA[
60+
61+
## Remarks
62+
63+
`isRemote` is not a part of W3C specification. It is needed for the OpenTelemetry scenarios.
64+
65+
]]></format>
66+
</remarks>
5167
</Docs>
5268
</Member>
5369
<Member MemberName="Equals">
@@ -73,8 +89,9 @@
7389
</Parameters>
7490
<Docs>
7591
<param name="value">To be added.</param>
76-
<summary>To be added.</summary>
77-
<returns>To be added.</returns>
92+
<summary>Indicates whether the current object is equal to another object of the same type.</summary>
93+
<returns>
94+
<see langword="true" /> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <see langword="false" />.</returns>
7895
<remarks>To be added.</remarks>
7996
</Docs>
8097
</Member>
@@ -141,9 +158,18 @@
141158
<ReturnType>System.Boolean</ReturnType>
142159
</ReturnValue>
143160
<Docs>
144-
<summary>To be added.</summary>
145-
<value>To be added.</value>
146-
<remarks>To be added.</remarks>
161+
<summary>Indicates if the activity context was propagated from a remote parent.</summary>
162+
<value>
163+
<see langword="true" /> if it was propagated from a remote parent; <see langword="false" /> otherwise.</value>
164+
<remarks>
165+
<format type="text/markdown"><![CDATA[
166+
167+
## Remarks
168+
169+
`IsRemote` is not a part of W3C specification. It is needed for the OpenTelemetry scenarios.
170+
171+
]]></format>
172+
</remarks>
147173
</Docs>
148174
</Member>
149175
<Member MemberName="op_Equality">
@@ -216,8 +242,8 @@
216242
<ReturnType>System.Diagnostics.ActivitySpanId</ReturnType>
217243
</ReturnValue>
218244
<Docs>
219-
<summary>To be added.</summary>
220-
<value>To be added.</value>
245+
<summary>The Id of the request as known by the caller.</summary>
246+
<value>The Span Id in the context.</value>
221247
<remarks>To be added.</remarks>
222248
</Docs>
223249
</Member>
@@ -237,8 +263,8 @@
237263
<ReturnType>System.Diagnostics.ActivityTraceFlags</ReturnType>
238264
</ReturnValue>
239265
<Docs>
240-
<summary>To be added.</summary>
241-
<value>To be added.</value>
266+
<summary>The flags defined by the W3C standard along with the ID for the activity.</summary>
267+
<value>The context tracing flags.</value>
242268
<remarks>To be added.</remarks>
243269
</Docs>
244270
</Member>
@@ -258,8 +284,8 @@
258284
<ReturnType>System.Diagnostics.ActivityTraceId</ReturnType>
259285
</ReturnValue>
260286
<Docs>
261-
<summary>To be added.</summary>
262-
<value>To be added.</value>
287+
<summary>The trace identifier.</summary>
288+
<value>The tracing identifier in the context.</value>
263289
<remarks>To be added.</remarks>
264290
</Docs>
265291
</Member>
@@ -279,8 +305,8 @@
279305
<ReturnType>System.String</ReturnType>
280306
</ReturnValue>
281307
<Docs>
282-
<summary>To be added.</summary>
283-
<value>To be added.</value>
308+
<summary>Holds the W3C 'tracestate' header.</summary>
309+
<value>A string representing the W3C 'tracestate' header.</value>
284310
<remarks>To be added.</remarks>
285311
</Docs>
286312
</Member>

0 commit comments

Comments
 (0)