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
@@ -169,11 +170,13 @@ Now let's execute some requests on the app [http://localhost:4000/](http://local
169
170

170
171

171
172
172
-
In addition to traces in the Java auto-instrumentation also emits logs and metrics.
173
+
In addition to traces in the Java auto-instrumentation also emits **logs** and **metrics**.
173
174
The logs in our case are printed into the collector stdout via `debug` exporter and metrics are sent via OTLP HTTP into Prometheus.
174
175
The OpenTelemetry spec defines that the following metrics should be collected: [HTTP metrics](https://opentelemetry.io/docs/specs/semconv/http/http-metrics/).
2024-03-12T17:35:55.712Z INFO 7 --- [ main] io.opentelemetry.dice.DiceApplication : Starting DiceApplication v0.0.1-SNAPSHOT using Java 21.0.2 with PID 7 (/usr/src/app/build/libs/dice-0.0.1-SNAPSHOT.jar started by root in /usr/src/app)
249
+
2024-03-12T17:35:55.749Z INFO 7 --- [ main] io.opentelemetry.dice.DiceApplication : No active profile set, falling back to 1 default profile: "default"
250
+
2024-03-12T17:35:57.556Z INFO 7 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 5165 (http)
251
+
2024-03-12T17:35:57.588Z INFO 7 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-03-12T17:35:57.667Z INFO 7 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
254
+
2024-03-12T17:35:57.669Z INFO 7 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1800 ms
255
+
2024-03-12T17:35:58.293Z INFO 7 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 5165 (http) with context path ''
256
+
2024-03-12T17:35:58.308Z INFO 7 --- [ main] io.opentelemetry.dice.DiceApplication : Started DiceApplication in 3.459 seconds (process running for 6.305)
257
+
2024-03-12T17:37:04.363Z INFO 7 --- [nio-5165-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
258
+
2024-03-12T17:37:04.364Z INFO 7 --- [nio-5165-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
259
+
2024-03-12T17:37:04.365Z INFO 7 --- [nio-5165-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
260
+
2024-03-12T17:37:04.435Z INFO 7 --- [nio-5165-exec-1] io.opentelemetry.dice.RollController : Player 2 is rolling the dice: 2
261
+
2024-03-12T17:37:04.736Z WARN 7 --- [nio-5165-exec-3] io.opentelemetry.dice.RollController : Illegal number rolled, setting result to '1'
262
+
2024-03-12T17:37:04.737Z INFO 7 --- [nio-5165-exec-3] io.opentelemetry.dice.RollController : Player 2 is rolling the dice: 1
228
263
```
229
264
230
265
```bash
@@ -234,9 +269,30 @@ Open Prometheus in the browser [localhost:8080](http://localhost:8080/graph?g0.e
234
269
235
270

236
271
237
-
### Customize spans created by the auto-instrumentation
272
+
### Customize Java auto-instrumentation with config (capture more data)
273
+
274
+
In this section we will configure the Java auto-instrumentation by modifying `Instrumentation` CR to:
275
+
* create custom spans - for the main method of the application
276
+
* capture server response HTTP headers
277
+
278
+
See the [Java agent docs](https://opentelemetry.io/docs/languages/java/automatic/configuration/) with all the configuration options.
279
+
280
+
See the [Instrumentation CR](./app/instrumentation-java-custom-config.yaml).
0 commit comments