Skip to content

Commit

Permalink
linting and formatting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nerudadhich committed Nov 17, 2023
1 parent 364ed7e commit a386853
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions content/en/docs/instrumentation/java/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ Follow the instructions of each instrumentation library to set them up.

## Example app preparation {#example-app}

We will instrument an HTTP client application using library instrumentation which will make a call to HTTP server.
We will instrument an HTTP client application using library instrumentation
which will make a call to HTTP server.

You can use the dice example app as HTTP server from
[Getting Started](/docs/instrumentation/java/getting-started/) or you can create your own HTTP server.
[Getting Started](/docs/instrumentation/java/getting-started/) or you can create
your own HTTP server.

### Dependencies {#example-app-dependencies}

To begin, set up an environment in a new directory called `java-simple-http-client`. Within
that directory, create a file called `build.gradle.kts` with the following
content:
To begin, set up an environment in a new directory called
`java-simple-http-client`. Within that directory, create a file called
`build.gradle.kts` with the following content:

```kotlin
plugins {
Expand Down Expand Up @@ -69,7 +71,8 @@ dependencies {

### Setup {#example-app-setup}

As an example, here's how you can instrument external API calls using [Java HTTP client library](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/java-http-client/library).
As an example, here's how you can instrument external API calls using
[Java HTTP client library](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/java-http-client/library).

```java
// ExampleConfiguration.java
Expand Down Expand Up @@ -173,18 +176,24 @@ export EXTERNAL_API_ENDPOINT=http://localhost:8080/rolldice

### Run example app {#example-app-run}

Run `source .env` to export environment variables, by default it will point to `http://localhost:8080/rolldice` where [example dice app](/docs/instrumentation/java/getting-started/#example-application) is running.
Run `source .env` to export environment variables, by default it will point to
`http://localhost:8080/rolldice` where
[example dice app](/docs/instrumentation/java/getting-started/#example-application)
is running.

When you run this code `gradle run`, the instrumentation libraries will
When you run this code `gradle run`, the instrumentation libraries will

- Start a new trace
- Generate a span representing the request made to the external API endpoint
- If you will use instrumented HTTP server eg. [example dice app](/docs/instrumentation/java/getting-started/#example-application) then more trace span will be generated which will have same trace id.
- If you will use instrumented HTTP server eg.
[example dice app](/docs/instrumentation/java/getting-started/#example-application)
then more trace span will be generated which will have same trace ID.

## Available instrumentation libraries

A full list of instrumentation libraries produced by OpenTelemetry is available
here [opentelemetry-java-instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks).
here
[opentelemetry-java-instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks).

## Next steps

Expand All @@ -193,10 +202,10 @@ After you have set up instrumentation libraries, you may want to add
telemetry data.

You'll also want to configure an appropriate exporter to
[export your telemetry data](/docs/instrumentation/java/exporters) to one or more
telemetry backends.
[export your telemetry data](/docs/instrumentation/java/exporters) to one or
more telemetry backends.

You can also check the
[automatic instrumentation for Java](/docs/instrumentation/java/automatic).

[opentelemetry-java]: https://github.com/open-telemetry/opentelemetry-java
[opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java)

0 comments on commit a386853

Please sign in to comment.