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: tutorial/content/exercises/instrumentation/automatic/zero-code/index.md
+74-1Lines changed: 74 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -238,7 +238,7 @@ You can see multiple statements of the `otel.javaagent` but if you take a closer
238
238
239
239
This is how the auto-instrumentation works here. It uses a collection of instrumentation library to trace default components, which the Java application uses here.
240
240
241
-
However it makes another problem obvious: There are many spans being collected and it is hard to read on the console with the human eye.
241
+
However, it makes another problem obvious: There are many spans being collected and it is hard to read on the console with the human eye.
242
242
243
243
If you execute another `curl` call in your other shell to add a new item, e.g.
244
244
@@ -340,6 +340,79 @@ You can observe the different behaviour in the Jaeger console.
340
340
If you are familiar with Java you can of course also look at the code in the folder: `src/main/java/io/novatec/todobackend`
341
341
Open the TodobackendApplication.java with your VS Code built-in editor.
342
342
343
+
### Excursus - Configuration of Java agent
344
+
345
+
The OpenTelemetry Java agent provides a vast amount of features out of the box and normally requires no further configuration.
346
+
Nevertheless, it provides several configuration properties to adapt its behaviour to your needs.
347
+
Those properties can be set via `-D` flags, environment variables (as seen above) or properties file,
348
+
which can be referenced with `otel.javaagent.configuration-file`.
349
+
Below we will explain some useful agent properties.
350
+
351
+
There is a properties file in the `resources` directory, which can be used to test some configuration properties.
352
+
Run the following command to start the Java application with the configuration file:
All properties expect a comma-separated list of HTTP header names, which should be read and written into span attributes.
399
+
400
+
#### Agent extensions
401
+
402
+
The Java agent provides an extension API, which allows you to extend its behaviour with your custom logic.
403
+
This also allows you to extend the instrumentation without changing the application codebase.
404
+
For instance, you would like to collect business data with the Java agent. Since the agent itself doesn't know your
405
+
business logic, you can include your extension to capture such data.
406
+
407
+
An extension resembles an additional JAR file, which has to be referenced via `otel.javaagent.extensions`.
408
+
409
+
There are some example for such extensions in [GitHub](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/extension).
410
+
411
+
<!--Later, we can add another chapter to explain in detail how to write agent extensions by yourself -->
412
+
413
+
Take a look at the [OpenTelemetry documentation](https://opentelemetry.io/docs/zero-code/java/agent/)
414
+
to learn more about the agent configuration.
415
+
343
416
### Instrumentation of the Python (Flask) component
344
417
345
418
Now that we have successfully auto-instrumented the Java part of the application, let's focus how to achieve similar results with the Python part. Leave the docker container and the Java part from the previous step up und running, we still need it now.
0 commit comments