UDP Gateway can publish custom Amazon CloudWatch metrics into your AWS account for Listeners and Destinations. Listener metrics measure application and protocol traffic; destination metrics measure application deliveries and replies. Packet Source deliveries are included in listener egress and also published as separate per-source egress metrics. This reference explains how to configure and interpret these overlapping scopes.
MetricsEnabled is optional and defaults to false. Set it to true
at either or both levels:
Properties.MetricsEnabled and supply
Properties.Role, the listener's observability role.MetricsEnabled on that destination and grant
metric publishing permission to its own Role, alongside its delivery permissions.MetricsEnabled setting
and observability role. No separate source metrics setting or role is needed.These switches are independent: enabling a listener does not enable its destinations, and enabling a
destination does not enable its listener. Listener metrics are recorded at the transport boundary,
not calculated by summing destination metrics.
A listener role is required when listener metrics are enabled or a listener LogGroupName is set.
Use Role.Arn for the IAM role ARN at both levels.
Add this statement to each role that publishes metrics. CloudWatch's PutMetricData action
requires Resource: "*"; the namespace condition restricts where the role can publish:
{
"Effect": "Allow",
"Action": "cloudwatch:PutMetricData",
"Resource": "*",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "Proxylity/UDP Gateway"
}
}
}
The role must also trust Proxylity to assume it. Use your account's configured Proxylity trust policy;
see Access & Permissions.
The listener observability role does not need destination delivery permissions. The destination role
still needs permissions such as sqs:SendMessage for its target resource.
Metrics do not require LogGroupName. Logging is separately enabled by that property and
requires an existing log group plus logs:CreateLogStream and logs:PutLogEvents
permissions on its log streams. Disabling metrics does not disable configured logging.
AWS custom metric and alarm charges may apply; see
CloudWatch pricing.
This template uses existing IAM roles and an existing SQS queue. Supply your Service Token and API key, a trusted client CIDR, and role ARNs. Both roles need the metric permission above; the destination role also needs SQS delivery permissions. The DTLS listener illustrates transport-level metrics alongside destination traffic metrics.
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ServiceToken:
Type: String
ApiKey:
Type: String
NoEcho: true
ClientCidr:
Type: String
Description: Trusted client network in CIDR notation
ListenerObservabilityRoleArn:
Type: String
DestinationRoleArn:
Type: String
QueueArn:
Type: String
Resources:
Listener:
Type: Custom::ProxylityUdpGatewayListener
Properties:
ServiceToken: !Ref ServiceToken
ApiKey: !Ref ApiKey
Protocols: [dtls]
MetricsEnabled: true
Role:
Arn: !Ref ListenerObservabilityRoleArn
ClientRestrictions:
Networks:
- !Ref ClientCidr
Destinations:
- Name: metrics-example-queue
DestinationArn: !Ref QueueArn
MetricsEnabled: true
Role:
Arn: !Ref DestinationRoleArn
For property details, see the Listener, Destination, and Role references.
The exact, case-sensitive namespace is Proxylity/UDP Gateway (including the space).
Every metric has exactly one of these dimensions:
| Scope | Dimension name | Dimension value |
|---|---|---|
| Listener | Listener | The configured or generated listener name, which is also the value returned by Ref. |
| Destination | Destination | The configured or generated destination Name. |
| Packet Source | PacketSource | The Packet Source's identifier, which is the value returned by Ref: <listener name>|<suffix>. The pipe character is part of the value. |
Use the resource's actual name or identifier, not its ARN, port, domain, or template logical ID. You can find generated
names in the Proxylity dashboard. A generated listener name is formed from the stack name, the logical ID and
a random 8-character suffix; a generated destination name has the form
dstn-<stack name>-<logical ID>-<n>. To read them from CloudFormation, use
Ref for a listener and the listener's DestinationNames attribute for its destinations
(see the Listener reference). There are no combined dimensions or
dimensionless account totals. A shared destination aggregates its recorded traffic from all attached listeners.
CloudWatch metrics are regional. Listener and Packet Source metrics are published in the region of the gateway instance processing the traffic. Destination metrics use the resolved destination ARN's region, falling back to the gateway region when the ARN has no region. For multi-region deployments, inspect each relevant region rather than assuming that all metrics appear in the CloudFormation stack's region.
Logs follow the same rule as metrics. Listener logs are written in the region where traffic entered the gateway. Destination logs are written in the region of the resolved destination ARN, or in the region where traffic entered when the ARN has no region. The log group must exist in each such region; where it does not, no logs are written.
Listeners and destinations publish the same seven metric names when telemetry is available.
Packet Sources publish only EgressPackets and EgressBytes, using application
payload lengths before transport encryption or encapsulation. They do not publish ingress, filtered,
or error metrics. Their successful deliveries also contribute to the bound listener's egress counters
at transport-encoded lengths.
| Metric | Unit | Listener meaning | Destination meaning |
|---|---|---|---|
IngressPackets | Count | Size-weighted units for all datagrams admitted by the listener firewall while the listener is not suspended, before protocol processing. | Size-weighted units for packets that pass the destination filter and are successfully added to its delivery queue. |
IngressBytes | Bytes | UDP payload bytes of admitted datagrams, including transport encryption and encapsulation overhead but excluding Proxy Protocol and outer IP/UDP headers. | Byte lengths associated with accepted, queued packets; not the serialized AWS request size. |
EgressPackets | Count | Size-weighted units for every successfully sent datagram, including application replies, Packet Source deliveries, and protocol traffic. | Size-weighted units for response packets successfully sent to clients through the listener, not requests sent to the AWS service. |
EgressBytes | Bytes | Transport-encoded datagram bytes, including encryption and encapsulation overhead but excluding outer IP/UDP headers. | Response payload bytes before listener transport encryption or encapsulation. |
FilteredPackets | Count | Size-weighted units for datagrams denied by the listener firewall (Client Restrictions) or dropped because the listener is suspended; excluded from listener ingress. | Size-weighted units for packets rejected by this destination's FilterExpression. |
FilteredBytes | Bytes | UDP payload bytes of those denied or suspended-listener datagrams, using the same byte boundary as listener ingress. | Byte lengths associated with packets rejected by this destination's filter. |
Errors | Count | Occurrences of reported errors attributed to this listener or destination, including delivery, batch-processing, and observability-role failures. Repeated errors count once per occurrence, not once per distinct message. Warnings and informational messages are excluded. | |
The three *Packets metrics are not raw datagram counts. Each recorded packet contributes
max(1, ceil(recorded byte length / 1024)) units. For example, lengths of 100, 1023, 1024,
1025, and 2048 bytes contribute 1, 1, 1, 2, and 2 units respectively. An empty packet contributes
one unit and zero bytes. The *Bytes metrics add the
recorded byte lengths directly. Do not use the packet metrics as literal packet-per-second measurements.
Ingress means accepted into the delivery queue, not confirmed delivery to the AWS service. Filtered traffic is excluded from that destination's ingress. A packet fanned out to two destinations can count toward both destinations, so summing them does not produce unique listener traffic.
Destination ingress and filtered byte accounting currently use the original incoming UDP payload length. For encrypted transports, this may include transport overhead even though the delivered application payload is decrypted or decapsulated. Egress uses the reply payload length before transport encoding. These are not Ethernet/IP wire-byte measurements or JSON/base64 request sizes.
A one-way destination such as SQS does not generate response packets, so zero destination egress is expected even while packets are being delivered successfully. Batching does not turn these counters into AWS API call counts; no batch-count metric is currently published.
Listener counters measure both application and protocol traffic at the transport boundary. Ingress is recorded once per admitted datagram before decryption, decapsulation, protocol validation, destination filtering, or queueing. It therefore includes traffic that never produces an application delivery. Listener egress is recorded only after a successful send:
PSRC usage records,
keyed by the Packet Source's identifier, record the application payload length before transport encoding.
Their egress counters are also published with dimension PacketSource set to
the Packet Source's identifier, using the bound listener's metrics setting and observability role.Firewall-denied and suspended-listener datagrams contribute only to listener
FilteredPackets/FilteredBytes, not ingress. Invalid transport packets
admitted by the firewall on an active listener remain ingress, not filtered. Destination BREX
rejection affects only that destination's filtered counters; the datagram remains listener ingress.
Traffic that cannot be attributed to a listener is not included in its counters.
Dropped or failed sends do not contribute to egress. A successful send is not proof of client receipt.
For one listener and the same reporting period, IngressBytes + FilteredBytes gives
inbound UDP payload bytes accounted for at that listener. Its firewall/suspension rejection fraction
is FilteredBytes / (IngressBytes + FilteredBytes) when the denominator is nonzero.
Using the packet metrics instead gives a size-weighted unit fraction, not a raw datagram fraction.
Listener and destination/source counters overlap: do not add them together as unique traffic or infer billable usage by summing scopes. For example, one admitted 100-byte UDP datagram queued to two destinations contributes one listener ingress unit and one ingress unit to each destination, not three unique inbound packets. If one destination rejects it, listener ingress is unchanged; that destination records one filtered unit instead of ingress.
Byte boundaries also affect rounding: a 1024-byte application reply contributes one destination (or source usage) egress unit. If transport encoding makes the sent datagram 1056 bytes, the listener records two egress units and 1056 bytes for the same reply. Protocol-only output and retransmissions can increase listener egress further. Neither destination-to-listener ratios nor ingress-to-egress ratios are delivery-success rates.
Error metrics and CloudWatch Logs can be enabled independently. Reported errors contribute to
Errors even when LogGroupName is not configured. A logged error contributes
one occurrence, which may describe a failure affecting multiple packets or a batch.
Configure logs for diagnostic details and combine gateway metrics with the AWS destination
service's own metrics for end-to-end monitoring.
The gateway collects telemetry in roughly 10-second reporting intervals and publishes interval totals, not lifetime counters. These are standard-resolution CloudWatch custom metrics, not high-resolution metrics. Use Sum with periods of 60 seconds or longer for traffic and error totals. Average averages submitted interval samples; it does not give total traffic. To calculate bytes per second, divide the byte metric's period Sum by the period length in seconds.
Only resources with telemetry in an interval are published. An active listener or destination's seven metrics can contain zeros, but an idle resource does not receive a continuous stream of zero samples. An active Packet Source publishes only the two egress counters. Metrics may not appear until a recorded event occurs. Configure alarm missing-data handling deliberately; absence of data is not automatically evidence of healthy or unhealthy traffic.
In the CloudWatch console, select the appropriate account and region, then open
Metrics > All metrics > Proxylity/UDP Gateway. Select the
Listener, Destination, or PacketSource dimension and the actual
resource name or source identifier.
This CloudFormation resource snippet alarms on any counted error for one destination over five minutes.
Replace metrics-example-queue with its actual name and deploy in the metric's region.
Add AlarmActions with your SNS topic ARN if you want notifications.
The alarm measures error occurrences, not the number of affected packets.
DestinationRecordedErrors:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: UDP Gateway reported errors for this destination
Namespace: Proxylity/UDP Gateway
MetricName: Errors
Dimensions:
- Name: Destination
Value: metrics-example-queue
Statistic: Sum
Period: 300
EvaluationPeriods: 1
Threshold: 0
ComparisonOperator: GreaterThanThreshold
TreatMissingData: notBreaching
For a listener alarm, change the dimension name to Listener and use the listener's actual
name. Do not omit the dimension or add extra dimensions: those identify different metric series.
MetricsEnabled on the specific listener or destination, not only its parent or child.
Packet Source metrics follow the bound listener's setting.cloudwatch:PutMetricData for the exact namespace.