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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbasicCancel(Channel channel, String consumerTag) voidbasicConsume(Channel channel, String consumerTag, boolean autoAck) voidvoidvoidbasicPublish(Channel channel) voidbasicPublishAck(Channel channel, long deliveryTag, boolean multiple) voidbasicPublishFailure(Channel channel, Throwable cause) voidbasicPublishNack(Channel channel, long deliveryTag, boolean multiple) voidbasicPublishUnrouted(Channel channel) voidbasicReject(Channel channel, long deliveryTag) voidbasicReject(Channel channel, long deliveryTag, boolean requeue) voidClean inner state for close connections and channels.voidcloseChannel(Channel channel) voidcloseConnection(Connection connection) voidconsumedMessage(Channel channel, long deliveryTag, boolean autoAck) voidconsumedMessage(Channel channel, long deliveryTag, String consumerTag) protected abstract voiddecrementChannelCount(Channel channel) Decrements channel count.protected abstract voiddecrementConnectionCount(Connection connection) Decrements connection count.protected abstract voidincrementChannelCount(Channel channel) Increments channel count.protected abstract voidincrementConnectionCount(Connection connection) Increments connection count.protected abstract voidMarks the event of an acknowledged message.protected abstract voidMarks the event of a consumed message.protected abstract voidMarks the event of a message publishing acknowledgement.protected abstract voidMarks the event of a message publishing failure.protected abstract voidMarks the event of a message publishing not being acknowledged.protected abstract voidMarks the event of a published message.protected abstract voidMarks the event of a published message not being routed.protected abstract voidDeprecated.protected voidmarkRejectedMessage(boolean requeue) Marks the event of a rejected message.voidnewChannel(Channel channel) voidnewConnection(Connection connection)
-
Constructor Details
-
AbstractMetricsCollector
public AbstractMetricsCollector()
-
-
Method Details
-
newConnection
- Specified by:
newConnectionin interfaceMetricsCollector
-
closeConnection
- Specified by:
closeConnectionin interfaceMetricsCollector
-
newChannel
- Specified by:
newChannelin interfaceMetricsCollector
-
closeChannel
- Specified by:
closeChannelin interfaceMetricsCollector
-
basicPublish
- Specified by:
basicPublishin interfaceMetricsCollector
-
basicPublishFailure
- Specified by:
basicPublishFailurein interfaceMetricsCollector
-
basicPublishAck
- Specified by:
basicPublishAckin interfaceMetricsCollector
-
basicPublishNack
- Specified by:
basicPublishNackin interfaceMetricsCollector
-
basicPublishUnrouted
- Specified by:
basicPublishUnroutedin interfaceMetricsCollector
-
basicConsume
- Specified by:
basicConsumein interfaceMetricsCollector
-
basicCancel
- Specified by:
basicCancelin interfaceMetricsCollector
-
consumedMessage
- Specified by:
consumedMessagein interfaceMetricsCollector
-
consumedMessage
- Specified by:
consumedMessagein interfaceMetricsCollector
-
basicAck
- Specified by:
basicAckin interfaceMetricsCollector
-
basicNack
- Specified by:
basicNackin interfaceMetricsCollector
-
basicNack
- Specified by:
basicNackin interfaceMetricsCollector
-
basicReject
- Specified by:
basicRejectin interfaceMetricsCollector
-
basicReject
- Specified by:
basicRejectin 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()Deprecated.UsemarkRejectedMessage(boolean)insteadMarks the event of a rejected message. -
markRejectedMessage
protected void markRejectedMessage(boolean requeue) 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.
-
markRejectedMessage(boolean)instead