dynatrace-extensions / dt-extensions-python-sdk

Dynatrace Python Extensions SDK
https://dynatrace-extensions.github.io/dt-extensions-python-sdk/
MIT License
8 stars 2 forks source link

Automatically split the payload for metrics based on the size of the payload before sending to EEC #52

Closed j01am closed 1 month ago

j01am commented 2 months ago

We get a lot of errors like : code: 413 message: Payload must not be larger than 1048576 bytes Would it be beneficial to implement split sending based on size, in addition to splitting by the number of lines?

dlopes7 commented 2 months ago

Maybe, this is also more resource intensive

Can you please share some examples of these long lines you need to ingest?

You can also split the metrics before reporting them

j01am commented 1 month ago

Hi !

We are hitting the size limit with Metrics that have around 25 dimensions. A potential simple solution could be to address the issue with a try catch : If a size exception is caught, you can recursively call the send function with half of the payload.

For example, we sent lines with more than 1100 char :

send_metric: cloud.alicloud.ecs.memory_utilization,alicloud.instance_name="XXXXXX",alicloud.instance_id="i-gw82jct5y8ey92mwso2w",alicloud.instance_resource_group_id="",alicloud.instance_memory="8192",alicloud.instance_charge_type="PrePaid",alicloud.instance_cpu="2",alicloud.instance_network_type="vpc",alicloud.instance_host_name="XXXXXX",alicloud.instance_vlan_id="",alicloud.instance_stopped_mode="Not-applicable",alicloud.nstance_deletion_protection="False",alicloud.instance_internet_charge_type="PayByTraffic",alicloud.instance_deployment_set_id="",alicloud.instance_serial_number="xxxxx-xxxxxx-xxxxx-xxxxx",alicloud.instance_os_type="windows",alicloud.instance_gpu_spec="",alicloud.instance_device_available="True",alicloud.instance_type="ecs.sn2ne.large",alicloud.instance_os_name_en="Windows Server 2019 Data Center Edition 64bit English Edition",alicloud.instance_zone_id="eu-central-1a",alicloud.instance_cluster_id="",alicloud.instance_gpu_amount="0",alicloud.instance_region_id="eu-central-1",alicloud.instance_status="Running",alicloud.instance_networkinterfaceip="xx.xx.xx.xx" gauge,59.26 1716801540000