Description
Describe the feature
Right now, there is no clear way to know whether a request that is generated client-side will exceed 40 KiB request size limit for PutMetricData
requests. Exposing this to clients will allow them to craft requests to PutMetricData
that maximize the amount of datapoints per-request without exceeding the per-request limit.
Use Case
PutMetricData
has many restrictions on its use, specifically:
- No more than 150 requests per second per-region for a given account
- No more than 150 datapoints per metric datum in a given request
- No more than 20 metric datum per request
- Requests must not exceed 40 KiB in size
The rate limit motivates clients to pack as many values as possible (3,000) per request, but to do so in a way that does not exceed the 40 kilobyte / request limit. It would be nice if there were a way to expose what the size of a request is client-side so that we don't hit errors like:
RequestEntityTooLarge: Request size 45305 exceeded 40960 bytes
status code: 413,
Proposed Solution
A function should be exposed for a cloudwatch.PutMetricDataInput
which calculates the size of the request so that clients can determine whether or not they need to split up a single cloudwatch.PutMetricDataInput
into multiple, smaller cloudwatch.PutMetricDataInput
s. Additionally, it would be useful to have the size calculated with or without gzip compression enabled.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
SDK version used
v1.44.33
Environment details (Version of Go (go version
)? OS name and version, etc.)
go version go1.17.6 linux/amd64