Download the PHP package pmg/queue-cloudwatch without Composer
On this page you can find all versions of the php package pmg/queue-cloudwatch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pmg/queue-cloudwatch
More information about pmg/queue-cloudwatch
Files in pmg/queue-cloudwatch
Package queue-cloudwatch
Short Description Track your queue with CloudWatch metrics
License Apache-2.0
Informations about the package queue-cloudwatch
Queue CloudWatch
A pmg/queue
driver decorator that dispatches cloudwatch metrics when messages
are sent through.
Example
Metrics
All metrics have the dimensions...
QueueName
- The name of the queue to which the metrics belongMessageName
- The value returned fromMessage::getName
. When a message is not present for logging the metric, this dimension will be set to__none__
.
Driver Metrics
DriverError
- ACount
metric unit fired when the wrapped driver throws aDriverError
exception. This will have anErrorClass
dimension that contains the exception class name that was thrown.
Message Counts
There's a metric for each method on the driver, essentially. They all use
Count
as the metric unit.
MessageEnqueue
- Fired onDriver::enqueue
MessageDequeue
- Fired onDriver::dequeue
. This is only fired when a message is returned from the wrappedDriver::dequeue
.MessageSuccess
- Fired onDriver::ack
MessageFailure
- Fired onDriver::fail
MessageRetry
- Fired onDriver::retry
MessageRelease
- Fired onDriver::release
You might use these message counts to alert on a high volume of message failures or retries.
Message Timers
The metrics driver will time dequeued jobs until they are acked, failed, or
retried. These all use Milliseconds
as their metric unit.
MessageTime
- The amount of time a message took, tracked for every message regardless of how it finished.
The MessageTime
metric will have an additional dimension named MessageStatus
which is how the given message finished when the timer completed. This will be:
Success
when the message was passed toDriver::ack
Failure
when the message was passed toDriver::fail
Retry
When the message was passed toDriver::retry
Release
When the message was passed toDriver::release
Error Handling
First up, the wrapped driver is always called first. If an error occurs from the wrapped driver it's tracked and rethrown before any further metrics can be logged. The idea here is that driver errors invalidate any processes acting on a message anyway.
Errors from the cloudwatch client are caught and logged, however. You can pass a
fourth $logger
argument to MetricsDriver
if you wish to see these errors,
but a NullLogger
is used by default.
Testing
The tests include a set of integration tests that actually talk to CloudWatch. Be sure to have set up credentials. in order to run those tests. Otherwise you may exclude them with...
All versions of queue-cloudwatch with dependencies
pmg/queue Version ^6.0
psr/log Version ^1.0 || ^2.0 || ^3.0
aws/aws-sdk-php Version ^3.0