It is reported by @artembilan
Currently, when jdbc.includes=QUERY is set, it still creates connection spans.
By quick look, the auto-config defines corresponding ObservationHandler beans based on the jdbc.includes property.
These Observationhandler bean classes use the instanceof for the observation context(Connection|Query|ResultSet]Context).
However, in Boot, the MicrometerTracingAutoConfiguration creates a default PropagatingSenderTracingObservationHandler bean.
This class performs context instanceof SenderContext. Since [Connection|Query|ResultSet]Context are a child of SenderContext, the default handler always matches and creates corresponding spans.
Instead of using ObservationHandler, it needs to use ObservationPredicate for the jdbc.includes to control whether to create observation(span/metrics) specified in the property.
It is reported by @artembilan Currently, when
jdbc.includes=QUERY
is set, it still createsconnection
spans.By quick look, the auto-config defines corresponding
ObservationHandler
beans based on thejdbc.includes
property. TheseObservationhandler
bean classes use theinstanceof
for the observation context(Connection|Query|ResultSet]Context
). However, in Boot, theMicrometerTracingAutoConfiguration
creates a defaultPropagatingSenderTracingObservationHandler
bean. This class performscontext instanceof SenderContext
. Since[Connection|Query|ResultSet]Context
are a child ofSenderContext
, the default handler always matches and creates corresponding spans.Instead of using
ObservationHandler
, it needs to useObservationPredicate
for thejdbc.includes
to control whether to create observation(span/metrics) specified in the property.