public class ObservationProxyExecutionListener extends Object implements ProxyExecutionListener
Constructor and Description |
---|
ObservationProxyExecutionListener(io.micrometer.observation.ObservationRegistry observationRegistry,
io.r2dbc.spi.ConnectionFactory connectionFactory,
String connectionUrl)
Constructor that takes a connection url.
|
ObservationProxyExecutionListener(io.micrometer.observation.ObservationRegistry observationRegistry,
io.r2dbc.spi.ConnectionFactory connectionFactory,
String host,
Integer port)
Constructor that takes host and port.
|
Modifier and Type | Method and Description |
---|---|
void |
afterQuery(QueryExecutionInfo executionInfo)
Called after executing a query (
Batch.execute() or Statement.execute() ). |
void |
beforeQuery(QueryExecutionInfo executionInfo)
Called before executing a query (
Batch.execute() or Statement.execute() ). |
void |
eachQueryResult(QueryExecutionInfo executionInfo)
Called on processing each query
Result . |
void |
setIncludeParameterValues(boolean includeParameterValues) |
void |
setQueryObservationConvention(QueryObservationConvention queryObservationConvention) |
void |
setQueryParametersTagProvider(QueryParametersTagProvider queryParametersTagProvider) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterMethod, beforeMethod
public ObservationProxyExecutionListener(io.micrometer.observation.ObservationRegistry observationRegistry, io.r2dbc.spi.ConnectionFactory connectionFactory, @Nullable String connectionUrl)
observationRegistry
- observation registryconnectionFactory
- connection factoryconnectionUrl
- connection url string (optional)public ObservationProxyExecutionListener(io.micrometer.observation.ObservationRegistry observationRegistry, io.r2dbc.spi.ConnectionFactory connectionFactory, @Nullable String host, @Nullable Integer port)
observationRegistry
- observation registryconnectionFactory
- connection factoryhost
- hostport
- port number (optional)public void beforeQuery(QueryExecutionInfo executionInfo)
ProxyExecutionListener
Batch.execute()
or Statement.execute()
).
Note: this callback is called when the publisher, result of the execute()
, is being
subscribed. Not at the time of execute()
is called,
Exception Handling:
Exceptions thrown by this method are dropped and do not affect the original subscription's publisher flow.
Such exceptions are reported to Hooks.onErrorDropped(java.util.function.Consumer)
.
beforeQuery
in interface ProxyExecutionListener
executionInfo
- query execution contextpublic void afterQuery(QueryExecutionInfo executionInfo)
ProxyExecutionListener
Batch.execute()
or Statement.execute()
).
The callback order is:
ProxyExecutionListener.beforeQuery(QueryExecutionInfo)
ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)
for 1st result
ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)
for 2nd result
ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)
for Nth result
ProxyExecutionListener.afterQuery(QueryExecutionInfo)
QueryExecutionInfo.getExecuteDuration()
is available in this callback and it holds
the duration since ProxyExecutionListener.beforeQuery(QueryExecutionInfo)
.
Note: this callback is called when the publisher, result of the execute()
, is being
subscribed. Not at the time of execute()
is called,
Exception Handling:
Exceptions thrown by this method are dropped and do not affect the original subscription's publisher flow.
Such exceptions are reported to Hooks.onErrorDropped(java.util.function.Consumer)
.
afterQuery
in interface ProxyExecutionListener
executionInfo
- query execution contextpublic void eachQueryResult(QueryExecutionInfo executionInfo)
ProxyExecutionListener
Result
.
While processing query results Result
, this callback
is called per result.
QueryExecutionInfo.getCurrentMappedResult()
contains the mapped result.
Exception Handling:
Exceptions thrown by this method are dropped and do not affect the original subscription's publisher flow.
Such exceptions are reported to Hooks.onErrorDropped(java.util.function.Consumer)
.
eachQueryResult
in interface ProxyExecutionListener
executionInfo
- query execution contextpublic void setIncludeParameterValues(boolean includeParameterValues)
public void setQueryParametersTagProvider(QueryParametersTagProvider queryParametersTagProvider)
public void setQueryObservationConvention(QueryObservationConvention queryObservationConvention)
Copyright © 2025. All rights reserved.