Skip to content

Bug: Why does DataDogProvider add_metric forceset a timestamp #6961

Open
@leandrodamascena

Description

@leandrodamascena

Discussed in #6256

Originally posted by manzkel March 12, 2025
Hey,

we have been trying to send custom metrics with lambda powertools to datadog for a few days. While enhanced metrics were sent and received on Datadog, custom metrics did not show up.

After some debugging we found something peculiar in the DatadogProvider and would like to know if there is a reason behind the code and whether there are certain settings to be set to make it work.

Concretely, here

the setting of a timestamp is forced. Which in turn on datadog end forces the execution of this condition https://github.com/DataDog/datadog-lambda-python/blob/6e2e5d54b870bbe5d2b028e726fef1b5d8f70552/datadog_lambda/metric.py#L78

The extension does not support timestamps for distributions so we create a
a thread stats writer to submit metrics with timestamps to the API

Running this on our end did not succeed in sending / receiving custom metrics. Creating a custom Provider which does not override the timestamp however, allowed it to succeed.

Are there some settings we are missing to be able to use the Thread Stats Writer or is this an unwanted behavior?

Thank you!

Metadata

Metadata

Labels

Type

No type

Projects

Status

Pending customer

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions