opentelemetry-java-instrume.../docs
moznion 7e8d76a83b
Put `http.route` attribute onto `http.server.duration` on Play framework request processing (#7801)
Basically, `akka-http` instrumenter has the responsibility to instrument
the `http.server.duration` for the Play framework application, but the
current implementation has not marked the `http.route` attribute.
ref:
8e8161cb2e/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerAttributesGetter.java (L59)

Actually, it's hard to record that attribute by only the akka-http layer
because that library's request object doesn't hold the route
information, e.g. placeholder.

So this patch delegates that job to the `play-mvc` instrumenter and when
that has been able to get the route info, the instrumenter puts
`http.route` attribute onto `http.server.duration`.

For example, when the routes configuration of the Play is like the
following:

```
GET  /foo/:bar  controllers.HomeController.doSomething(bar: String)
```

and when it tries to access that API, then OTEL instruments like so:

```prometheus
http_server_duration_count{otel_scope_name="io.opentelemetry.akka-http-10.0",otel_scope_version="1.23.0-alpha-SNAPSHOT",http_flavor="1.1",http_method="GET",http_route="/foo/$bar<[^/]+>",http_scheme="http",http_status_code="200",net_host_name="localhost",net_host_port="9000"} 1.0 1676078079798
http_server_duration_sum{otel_scope_name="io.opentelemetry.akka-http-10.0",otel_scope_version="1.23.0-alpha-SNAPSHOT",http_flavor="1.1",http_method="GET",http_route="/foo/$bar<[^/]+>",http_scheme="http",http_status_code="200",net_host_name="localhost",net_host_port="9000"} 12183.558843 1676078079798
http_server_duration_bucket{otel_scope_name="io.opentelemetry.akka-http-10.0",otel_scope_version="1.23.0-alpha-SNAPSHOT",http_flavor="1.1",http_method="GET",http_route="/foo/$bar<[^/]+>",http_scheme="http",http_status_code="200",net_host_name="localhost",net_host_port="9000",le="0.0"} 0.0 1676078079798
...
http_server_duration_bucket{otel_scope_name="io.opentelemetry.akka-http-10.0",otel_scope_version="1.23.0-alpha-SNAPSHOT",http_flavor="1.1",http_method="GET",http_route="/foo/$bar<[^/]+>",http_scheme="http",http_status_code="200",net_host_name="localhost",net_host_port="9000",le="+Inf"} 1.0 1676078079798
```

Rel: #1415

---------

Signed-off-by: moznion <moznion@mail.moznion.net>
2023-02-14 14:05:59 +02:00
..
apidiffs Post release steps (#7563) 2023-01-13 10:09:28 +01:00
contributing Update contributing doc for instrumentationModule (#7803) 2023-02-11 12:43:06 -08:00
misc Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
advanced-configuration-options.md Move advanced config to separate page (#5693) 2022-03-28 10:00:23 -07:00
agent-features.md Use "class loader" instead of "classloader" consistently in docs and comments (#6236) 2022-06-30 14:57:07 -07:00
java-7-rationale.md Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
logger-mdc-instrumentation.md Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
safety-mechanisms.md Use "class loader" instead of "classloader" consistently in docs and comments (#6236) 2022-06-30 14:57:07 -07:00
scope.md Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
semantic-conventions.md Update the OpenTelemetry SDK version to 1.23.0 (#7800) 2023-02-13 20:22:09 +00:00
supported-libraries.md Put `http.route` attribute onto `http.server.duration` on Play framework request processing (#7801) 2023-02-14 14:05:59 +02:00