Package com.rabbitmq.client.impl
Class AbstractMetricsCollector
java.lang.Object
com.rabbitmq.client.impl.AbstractMetricsCollector
- All Implemented Interfaces:
MetricsCollector
- Direct Known Subclasses:
MicrometerMetricsCollector
,OpenTelemetryMetricsCollector
,StandardMetricsCollector
Base class for
MetricsCollector
.
Implements tricky logic such as keeping track of acknowledged and
rejected messages. Sub-classes just need to implement
the logic to increment their metrics.
Note transactions are not supported (see MetricsCollector
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
basicCancel
(Channel channel, String consumerTag) void
basicConsume
(Channel channel, String consumerTag, boolean autoAck) void
void
basicPublish
(Channel channel) void
basicPublishAck
(Channel channel, long deliveryTag, boolean multiple) void
basicPublishFailure
(Channel channel, Throwable cause) void
basicPublishNack
(Channel channel, long deliveryTag, boolean multiple) void
basicPublishUnrouted
(Channel channel) void
basicReject
(Channel channel, long deliveryTag) void
Clean inner state for close connections and channels.void
closeChannel
(Channel channel) void
closeConnection
(Connection connection) void
consumedMessage
(Channel channel, long deliveryTag, boolean autoAck) void
consumedMessage
(Channel channel, long deliveryTag, String consumerTag) protected abstract void
decrementChannelCount
(Channel channel) Decrements channel count.protected abstract void
decrementConnectionCount
(Connection connection) Decrements connection count.protected abstract void
incrementChannelCount
(Channel channel) Increments channel count.protected abstract void
incrementConnectionCount
(Connection connection) Increments connection count.protected abstract void
Marks the event of an acknowledged message.protected abstract void
Marks the event of a consumed message.protected abstract void
Marks the event of a message publishing acknowledgement.protected abstract void
Marks the event of a message publishing failure.protected abstract void
Marks the event of a message publishing not being acknowledged.protected abstract void
Marks the event of a published message.protected abstract void
Marks the event of a published message not being routed.protected abstract void
Marks the event of a rejected message.void
newChannel
(Channel channel) void
newConnection
(Connection connection)
-
Constructor Details
-
AbstractMetricsCollector
public AbstractMetricsCollector()
-
-
Method Details
-
newConnection
- Specified by:
newConnection
in interfaceMetricsCollector
-
closeConnection
- Specified by:
closeConnection
in interfaceMetricsCollector
-
newChannel
- Specified by:
newChannel
in interfaceMetricsCollector
-
closeChannel
- Specified by:
closeChannel
in interfaceMetricsCollector
-
basicPublish
- Specified by:
basicPublish
in interfaceMetricsCollector
-
basicPublishFailure
- Specified by:
basicPublishFailure
in interfaceMetricsCollector
-
basicPublishAck
- Specified by:
basicPublishAck
in interfaceMetricsCollector
-
basicPublishNack
- Specified by:
basicPublishNack
in interfaceMetricsCollector
-
basicPublishUnrouted
- Specified by:
basicPublishUnrouted
in interfaceMetricsCollector
-
basicConsume
- Specified by:
basicConsume
in interfaceMetricsCollector
-
basicCancel
- Specified by:
basicCancel
in interfaceMetricsCollector
-
consumedMessage
- Specified by:
consumedMessage
in interfaceMetricsCollector
-
consumedMessage
- Specified by:
consumedMessage
in interfaceMetricsCollector
-
basicAck
- Specified by:
basicAck
in interfaceMetricsCollector
-
basicNack
- Specified by:
basicNack
in interfaceMetricsCollector
-
basicReject
- Specified by:
basicReject
in interfaceMetricsCollector
-
cleanStaleState
public void cleanStaleState()Clean inner state for close connections and channels. Inner state is automatically cleaned on connection and channel closing. Thus, this method is provided as a safety net, to be externally called periodically if closing of resources wouldn't work properly for some corner cases. -
incrementConnectionCount
Increments connection count. The connection object is passed in as complementary information and without any guarantee of not being null.- Parameters:
connection
- the connection that has been created (can be null)
-
decrementConnectionCount
Decrements connection count. The connection object is passed in as complementary information and without any guarantee of not being null.- Parameters:
connection
- the connection that has been closed (can be null)
-
incrementChannelCount
Increments channel count. The channel object is passed in as complementary information and without any guarantee of not being null.- Parameters:
channel
- the channel that has been created (can be null)
-
decrementChannelCount
Decrements channel count. The channel object is passed in as complementary information and without any guarantee of not being null.- Parameters:
channel
-
-
markPublishedMessage
protected abstract void markPublishedMessage()Marks the event of a published message. -
markMessagePublishFailed
protected abstract void markMessagePublishFailed()Marks the event of a message publishing failure. -
markConsumedMessage
protected abstract void markConsumedMessage()Marks the event of a consumed message. -
markAcknowledgedMessage
protected abstract void markAcknowledgedMessage()Marks the event of an acknowledged message. -
markRejectedMessage
protected abstract void markRejectedMessage()Marks the event of a rejected message. -
markMessagePublishAcknowledged
protected abstract void markMessagePublishAcknowledged()Marks the event of a message publishing acknowledgement. -
markMessagePublishNotAcknowledged
protected abstract void markMessagePublishNotAcknowledged()Marks the event of a message publishing not being acknowledged. -
markPublishedMessageUnrouted
protected abstract void markPublishedMessageUnrouted()Marks the event of a published message not being routed.
-