Add instrumentation API and native OpenTelemetry implementation#588
Add instrumentation API and native OpenTelemetry implementation#588swallez merged 9 commits intoelastic:mainfrom
Conversation
19a0531 to
73cab12
Compare
swallez
left a comment
There was a problem hiding this comment.
Thanks! Overall it looks nice.
Rather than the route (i.e. path template), using the API endpoint identifier would make things easier. This identifier comes from the API specification (see e.g. IndexRequest) and is available as endpoint.id().
Benefits:
- a single endpoint can have several routes and different http methods depending on which optional path parameters are set,
- using endpoint id avoids doing some pattern matching on the route for things like document id extraction.
- naming the span with the endpoint id ensures a 1:1 mapping from APIs to span names regardless of the path parameters set.
Note: I suggested this to @estolfo in a recent discussion.
java-client/src/main/java/co/elastic/clients/transport/Endpoint.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/transport/rest_client/InstrumentationUtil.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/transport/rest_client/InstrumentationUtil.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/transport/rest_client/InstrumentationUtil.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/transport/rest_client/InstrumentationUtil.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/transport/rest_client/InstrumentationUtil.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/transport/rest_client/InstrumentationUtil.java
Outdated
Show resolved
Hide resolved
I agree that we could improve some of the internal detection of request types by using the endpoint ID. I'll change that to make it more efficient and reliable. However, from an APM point of view, we would like to be able to differentiate the different patterns even within a single endpoint. For instance, we'd like to have different span names for requests to Regarding regex matching:
So my suggestion would be to use the endpoint id for internal optimization of the instrumentation but still exposing the actual pattern as the span names. WDYT? \cc @estolfo |
d81f7dc to
7f85f7f
Compare
|
As open-telemetry/semantic-conventions#23 has been merged, I updated this PR accordingly and also incorporated your suggestions. |
Signed-off-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
14e43a5 to
b49348c
Compare
Signed-off-by: Alexander Wert <alexander.wert@elastic.co> Co-authored-by: Sylvain Wallez <sylvain@elastic.co>
#652) Signed-off-by: Alexander Wert <alexander.wert@elastic.co> Co-authored-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
Adds an instrumentation API with request & response lifecycle callbacks, and an implementation based on OpenTelemetry that is used by default.
To be able to implement the OpenTelemetry semantic conventions, this PR also adds a
pathParametersmethod toEndpointthat provides access to the values in URL template placeholders.