Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End-to-end example applications #936

Merged
merged 37 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
41b1921
Suite of example applications demonstrating context propagation with …
alanwest Jul 28, 2020
d899d2a
Put System.* namespaces first
alanwest Jul 28, 2020
d3b2e51
Newline at EOF
alanwest Jul 28, 2020
203cad3
Fix markdownlint errors
alanwest Jul 28, 2020
38a2a5b
markdownlint fix
alanwest Jul 28, 2020
5fc6e6f
Merge branch 'master' into alanwest/end-to-end-example
cijothomas Jul 28, 2020
c75f113
Merge branch 'master' into alanwest/end-to-end-example
cijothomas Jul 28, 2020
bbbdb09
Merge branch 'master' into alanwest/end-to-end-example
cijothomas Jul 29, 2020
0ab8939
Refactor WorkerService separating OpenTelemetry related logic from Ra…
alanwest Jul 29, 2020
b58a421
Refactor WebApi separating OpenTelemetry related logic from RabbitMQ …
alanwest Jul 30, 2020
5248c04
Use environment variables for RabbitMQ user/pass
alanwest Jul 30, 2020
834503e
Add some comments
alanwest Jul 30, 2020
6191d9d
Merge remote-tracking branch 'upstream/master' into master
alanwest Jul 30, 2020
c38f060
Merge branch 'master' into alanwest/end-to-end-example
alanwest Jul 30, 2020
225fadf
Fix RabbitMQ default user/pass
alanwest Aug 1, 2020
ba436f0
Use correct ActivityKind
alanwest Aug 1, 2020
403faae
Add attributes following messaging specification
alanwest Aug 1, 2020
59da6cd
Clearing a path through the RabbitMQ jungle
alanwest Aug 2, 2020
b1e5de9
Merge branch 'master' into alanwest/end-to-end-example
alanwest Aug 2, 2020
9682076
Merge branch 'master' into alanwest/end-to-end-example
alanwest Aug 2, 2020
4d51283
Merge branch 'master' into alanwest/end-to-end-example
alanwest Aug 3, 2020
c925fa2
Merge branch 'master' into alanwest/end-to-end-example
alanwest Aug 6, 2020
807d0ea
Log something when sending/receiving a message
alanwest Aug 6, 2020
c2d0484
Code style clean up
alanwest Aug 6, 2020
413a56b
Default logging to info level
alanwest Aug 6, 2020
de660c6
Create queue if it does not exist
alanwest Aug 6, 2020
a647188
Rename controller to SendMessageController
alanwest Aug 6, 2020
c38945d
Refine the readme
alanwest Aug 6, 2020
7f0de78
MarkdownCop
alanwest Aug 7, 2020
bbdb926
Merge branch 'master' into alanwest/end-to-end-example
CodeBlanch Aug 7, 2020
0d1a90a
Merge branch 'master' into alanwest/end-to-end-example
alanwest Aug 8, 2020
ccc0847
Fix merge snafu
alanwest Aug 8, 2020
51784cf
Merge branch 'alanwest/end-to-end-example' of github.com:alanwest/ope…
alanwest Aug 8, 2020
437a990
Add null checks on activity
alanwest Aug 9, 2020
2d8bade
Add a missed null check
alanwest Aug 9, 2020
dcf093a
Use AddOpenTelemetry in ConfigureServices
alanwest Aug 9, 2020
dc654ad
Merge branch 'master' into alanwest/end-to-end-example
cijothomas Aug 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add attributes following messaging specification
  • Loading branch information
alanwest committed Aug 1, 2020
commit 403faaeff648f14399399a8df26224da63fc0239
10 changes: 10 additions & 0 deletions examples/MicroserviceExample/WebApi/MessageSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ internal string PublishMessage(IModel channel, string queueName)
// Inject the ActivityContext into the message headers.
TextFormat.Inject(activity.Context, props, InjectTraceContextIntoBasicProperties);

// These tags are added demonstrating the semantic conventions of the messaging specification
// See:
// * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes
// * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#rabbitmq
string DefaultExchange = string.Empty;
activity.AddTag("messaging.system", "rabbitmq");
activity.AddTag("messaging.destination_kind", "queue");
activity.AddTag("messaging.destination", DefaultExchange);
activity.AddTag("messaging.rabbitmq.routing_key", queueName);

var body = $"Published message: DateTime.Now = {DateTime.Now}.";

channel.BasicPublish(
Expand Down
10 changes: 10 additions & 0 deletions examples/MicroserviceExample/WorkerService/MessageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public async Task ProcessMessage(BasicDeliverEventArgs ea)

activity.AddTag("message", message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some other semantic tags we could demo here, like messaging.system, messaging.destination, messaging.destination_kind. Might be useful to show a mix of semantic tags and custom ones?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes all good suggestions. I also noted that the spec calls out some special considerations for RabbitMQ.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh. I haven't noticed that special RabbitMQ rule before, I'm going to have to fix some stuff IRL 😆


// These tags are added demonstrating the semantic conventions of the messaging specification
// See:
// * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes
// * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#rabbitmq
string DefaultExchange = string.Empty;
activity.AddTag("messaging.system", "rabbitmq");
activity.AddTag("messaging.destination_kind", "queue");
activity.AddTag("messaging.destination", DefaultExchange);
activity.AddTag("messaging.rabbitmq.routing_key", ea.RoutingKey);

// Simulate some work
await Task.Delay(1000);
}
Expand Down