You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scenario2.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# Scenario 2: REST API call chain
2
2
3
-
This scenario is an evolution from Scenario 1, containing a REST API in front of the time API. In this case trace will have to be transport between two processes over HTTP.
3
+
This scenario is an evolution from Scenario 1, containing a REST API in front of the existing Time REST API. In this case trace will have to be transport between two processes over HTTP.
1. End to end transaction details containing both REST APIs and the SQL dependency
11
+
1. End-to-end transaction details containing both REST APIs and the SQL dependency
12
12
13
13
## Implementation
14
14
@@ -25,7 +25,7 @@ public static void Main(string[] args)
25
25
26
26
The class `System.Diagnostics.Activity` is used by libraries to generate traces that can be observed by Diagnostic Listeners in order to generate spans/operations according to the tracing backend of choice. Examples are [Http Client](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md) and [Azure Service Bus](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-end-to-end-tracing).
27
27
28
-
As mentioned before, correlation happens by having spans sharing the same TraceID. To propagate the traceId used in first span http request headers are used. The forwarded value will then be used to argument new traces, correlating with the value used by the caller.
28
+
As mentioned before, correlation happens by having spans sharing the same TraceID. To propagate the traceId used in first span, http request headers are used. The forwarded value will then be used to argument new traces, correlating with the value used by the caller.
29
29
30
30
|Name|SpanId|ParentId|TraceId|
31
31
|-|-|-|-|
@@ -40,12 +40,12 @@ The header propagating the correlation is named `traceparent`, as [defined by W3
As you can observe there are 4 fields in the header value, separated by a '-':
43
+
There are 4 fields in the header value, separated by a '-':
44
44
45
45
-[Version](https://www.w3.org/TR/trace-context-1/#version): currently 00
46
46
-[TraceId](https://www.w3.org/TR/trace-context-1/#trace-id): The trace identifier started by caller
47
47
-[ParentId](https://www.w3.org/TR/trace-context-1/#parent-id): The span identifier that originated the call
48
-
-[Trace flags](https://www.w3.org/TR/trace-context-1/#sampled-flag): current version only supported the flag `sampled` which indicates if the caller is sampling the request
48
+
-[Trace flags](https://www.w3.org/TR/trace-context-1/#sampled-flag): current version only supported the flag `sampled`, which indicates if the caller is sampling the request
49
49
50
50
## Requirement validation
51
51
@@ -63,7 +63,7 @@ The same applies to Application Insights:
63
63
64
64

65
65
66
-
The dependency graph in Application Insights is available under Application Map:
66
+
The dependency graph in Application Insights is available under Application Map, displaying calls counter, avg. duration and error percentage:
@@ -12,7 +12,7 @@ This scenario covers asynchronous transactions using RabbitMQ queues. In that ca
12
12
13
13
## Implementation
14
14
15
-
It is necessary to write custom code to correlate RabbitMQ message consumption with the trace that generated the message. The sample application uses RabbitMQ message headers to include the trace parent of a each message.
15
+
It is necessary to write custom code to correlate RabbitMQ message consumption with the trace that generated the message. The sample application uses RabbitMQ message headers to include the trace parent of each message.
16
16
17
17
In publisher:
18
18
@@ -57,9 +57,9 @@ using (var operation = telemetryClient.StartOperation<RequestTelemetry>("Process
57
57
58
58
The requirement to track RabbitMQ publishing also requires additional code. The easier option is to use the target SDK and create spans/operations before calling RabbitMQ (as we did for SQL server in Open Telemetry).
59
59
60
-
The second option is to create what a SDK provider would have to in order to make simplify trace collector implementation. Through the usage of System.Diagnostics.Activity the activities are created. The actual creation of spans happens by listening to the diagnostics source.
60
+
The second option is to create System.Diagnostics.Activity objects, as a SDK provider would do. Collectors to OpenTelemetry or Application Insights subscribe to those activities, creating the the corresponding span (or dependency in Application Insights).
61
61
62
-
Code added to RabbitMQ publisher to generate activities:
62
+
This is the code added to RabbitMQ publisher to generate an activity:
The collector needs to subscribe to diagnostics source and create the appropriate target SDK span object. The sample project has a simplified implementation. For production quality please refer to OpenTelemetry and/or Application Insights built-in collectors and this [user guide](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md).
88
+
The sample project contains a simplified collector implementation for Application Insights and OpenTelemetry. For production quality please refer to OpenTelemetry and/or Application Insights built-in collectors and this [user guide](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md).
89
89
90
-
For OpenTelemetry this is how it looks like:
90
+
For OpenTelemetry, this is how it looks like:
91
91
92
92
```C#
93
93
publicclassRabbitMQListener : ListenerHandler
@@ -112,7 +112,36 @@ subscriber = new DiagnosticSourceSubscriber(new RabbitMQListener("Sample.RabbitM
112
112
subscriber.Subscribe();
113
113
```
114
114
115
-
The metrics requirements is simple to achieve using Application insights SDK:
115
+
To fulfill metrics requirements using OpenTelemetry, the sample application uses a Prometheus exporter.
0 commit comments