Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuelle committed Mar 10, 2023
1 parent 7492f11 commit 95943a4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions posts/2023-03-10-tracing-with-microprofile-telemetry.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The following diagram shows a system that consists of two services that both hav

image::img/blog/mptelemetry_diagram.png[Typical mpTelemetry usage architecture]

There are multiple ways that you can collect this data: automatic instrumentation, manual instrumentation, and the link:https://opentelemetry.io/docs/instrumentation/java/automatic/[Open Telemetry Java Agent].
There are multiple ways that you can collect this data: <<#auto,automatic instrumentation>>, <<#manual,manual instrumentation>>, and the <<#agent,Open Telemetry Java Agent>>.

MicroProfile Telemetry 1.0 is currently released as beta content. You can download the lastest version of the Open Liberty beta from the link:https://openliberty.io/start/#runtime_betas[Get Started] page. In this post, we'll use a simple demo application to show you how to collect traces from multiple services. Check out the code in the following repository:

Expand All @@ -48,6 +48,7 @@ Before we get started, let's get the backend set up.
To use Jaeger, follow the link:https://www.jaegertracing.io/docs/1.39/getting-started/[Jaeger Getting Started instructions].
If you would rather use Zipkin, you can follow the link:https://zipkin.io/pages/quickstart[Zipkin Quickstart].

[#auto]
## Automatic instrumentation

MicroProfile Telemetry 1.0 allows you to observe traces without modifying source code in your Jakarta RESTful web service (aka JAX-RS) applications.
Expand Down Expand Up @@ -81,11 +82,12 @@ A span for this request will be automatically created by MicroProfile Telemetry.

image::img/blog/mptelemetry_system_span.png[System span]

You just collected traces using Automatic Instrumentation! However, you might want to annotate selected methods or collect custom telemetry data. It's now time to modify source code to add more data to your spans.
You just collected traces using automatic instrumentation! However, you might want to annotate selected methods or collect custom telemetry data. It's now time to modify source code to add more data to your spans.

[#manual]
## Manual instrumentation

The automatic instrumentation only instruments Jakarta RESTful web service applications. To get further spans on other operations, such as database calls, you can add manual instrumentation to the source code.
Automatic instrumentation only instruments Jakarta RESTful web service applications. To get further spans on other operations, such as database calls, you can add manual instrumentation to the source code.

### Prerequisites

Expand Down Expand Up @@ -119,7 +121,7 @@ link:https://github.com/yasmin-aumeeruddy/mpTelemetry-Demo/blob/main/system/src/
</dependency>
----

### Code Instrumentation
### Manual instrumentation of application code

Now you are all set to instrument your code to manually create traces. We start by link:https://github.com/yasmin-aumeeruddy/mpTelemetry-Demo/blob/main/inventory/src/main/java/io/openliberty/demo/inventory/InventoryResource.java#L38-L42[injecting a Tracer and Span] object:

Expand Down Expand Up @@ -185,9 +187,10 @@ These spans are all part of one single trace that is emitted from the request to

For more information, see link:https://opentelemetry.io/docs/instrumentation/java/manual/[OpenTelemetry's manual instrumentation documentation].

## Java Agent
[#agent]
## Java agent instrumentation

The OpenTelemetry Java Agent enables Java applications to generate and capture telemetry data automatically using a JAR that can be attached to any Java 8+ application. Out-of-the-box tracing is provided for many link:https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks[libraries].
link:https://opentelemetry.io/docs/instrumentation/java/automatic/[Open Telemetry Java Agent] enables Java applications to generate and capture telemetry data automatically using a JAR that can be attached to any Java 8+ application. Out-of-the-box tracing is provided for many link:https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks[libraries].

You can attach the JAR by adding the following to your `pom.xml`:

Expand Down Expand Up @@ -246,7 +249,7 @@ The following limitations apply to using the agent to trace services:
### Annotations
* The agent instruments rest calls and methods annotated with `@WithSpan`. Therefore, the created spans may be slightly different to those you would see with MicroProfile Telemetry's manual instrumentation.

### Library Instrumentation
### Library instrumentation
* Open Liberty uses many open source libraries internally. Some of these might be instrumented automatically by the agent.

The agent creates and configures a global OpenTelemetry object using link:https://github.com/open-telemetry/opentelemetry-java-instrumentation#configuring-the-agent[environment variables and system properties]. Therefore, configuration is not read from link:https://openliberty.io/docs/latest/microprofile-config-properties.html[MicroProfile Config].
Expand Down

0 comments on commit 95943a4

Please sign in to comment.