Module org.neo4j.bolt.connection
Interface ObservationProvider
public interface ObservationProvider
An observation provider responsible for managing new and existing
Observation instances.- Since:
- 7.0.0
-
Method Summary
Modifier and TypeMethodDescriptionboltExchange(ImmutableObservation observationParent, String host, int port, BoltProtocolVersion boltVersion, BiConsumer<String, String> setter) Creates an observation for Bolt exchange.httpExchange(ImmutableObservation observationParent, URI uri, String method, String uriTemplate, BiConsumer<String, String> setter) Creates an observation for HTTP exchange.Returns an observation from the current scope if there is any.<T> TsupplyInScope(ImmutableObservation observation, Supplier<T> supplier) Runs the supplied logic in a scope of the given observation.
-
Method Details
-
boltExchange
BoltExchangeObservation boltExchange(ImmutableObservation observationParent, String host, int port, BoltProtocolVersion boltVersion, BiConsumer<String, String> setter) Creates an observation for Bolt exchange.The returned observation MUST be started.
- Returns:
- the new observation
-
httpExchange
HttpExchangeObservation httpExchange(ImmutableObservation observationParent, URI uri, String method, String uriTemplate, BiConsumer<String, String> setter) Creates an observation for HTTP exchange.The returned observation MUST be started.
- Returns:
- the new observation
-
scopedObservation
ImmutableObservation scopedObservation()Returns an observation from the current scope if there is any.- Returns:
- an observation or null if there is no observation in the scope
-
supplyInScope
Runs the supplied logic in a scope of the given observation. If the supplied observation is null, the supplier is executed without the scope.- Type Parameters:
T- the supplier's result type- Parameters:
observation- the observation or nullsupplier- the supplier- Returns:
- the supplier's result
-