Tracing indexing requests and search queries

Description

Provide support for creating "traces" during the execution of indexing and search queries, so that users can get collect that data and get insights into the behavior of their application ("what is taking so long?"/"which of my business operations are the most resource-intensive?"/...)

The hope is that it would replace Hibernate Search 5's JMX statistics support advantageously.

One challenge will be to forward the tracing context to background threads, since most indexing (and ES querying) is done in a different thread than the client thread.

Relevant:

Activity

Show:

Yoann Rodière September 25, 2023 at 9:58 AM

Alternatively to OpenTelemetry, it seems Java now offers the ability to register events through JFR, which has the advantage of being very lightweight, with apparently no impact whatsoever when tracing is disabled.

Yoann Rodière September 1, 2023 at 2:23 PM

Regarding the forwarding of tracing contexts to background threads, at least with opentracing it seems possible.

I discussed this with Bruno Baptista the other day, and he suggested using what he called “links” for the same purpose in OpenTelemety.

Yoann Rodière January 26, 2022 at 12:27 PM

Interestingly, there is an independently-developed Hibernate Search plugin for Elastic APM (a tracing solution):

So the need exists for sure.

Yoann Rodière June 14, 2021 at 8:08 AM

Note OpenTelemetry should now be preferred to OpenTracing.

Yoann Rodière January 6, 2021 at 12:55 PM

Regarding the forwarding of tracing contexts to background threads, at least with opentracing it seems possible.

OpenTracing has a concept of “references” between spans. See https://opentracing.io/specification/

At the moment there are two types of references: “child of” (~ method call, the parent waits for the child span to finish) and “forwards” (~ notification, the parent doesn’t care about the child span).

Interestingly, it would seem that a given span can have multiple references of the same type. So hopefully, when a bulk request is created that groups multiple indexing requests from multiple threads, we will be able to create a new span that references spans from all these threads? That would fit our use case perfectly…

Details

Assignee

Reporter

Components

Fix versions

Priority

Created October 15, 2020 at 1:38 PM
Updated August 29, 2024 at 12:30 PM