Skip to content

Bug: Why does DataDogProvider add_metric forceset a timestamp #6961

Closed

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!

Activity

  1. leandrodamascena commented on Jul 8, 2025

    @leandrodamascena
    ContributorAuthor

    Hey @manzkel thanks a lot for your huge patience on this topic! I was testing exhaustively this problem and I'm not sure if I'm reproducing the error.. I'm using this those layers in my Lambda with Python 3.12:

     Layers:
      - !Sub arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Python312:78
      - !Sub arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension:45
    

    I tried lot of times sending data both with timestamp and without timestamp and in both cases I was able to create custom metrics + enhanced metrics in DataDog

    image

    If it's still possible, can you help me understand a little better what's happening on your side?

    I'm converting this discussion into an issue.

  2. moved this from Triage to Pending customer in Powertools for AWS Lambda (Python)on Jul 8, 2025
  3. leandrodamascena commented on Aug 11, 2025

    @leandrodamascena
    ContributorAuthor

    Hi @manzkel, I'm closing this issue for now, but feel free to reopen it if you still have issues.

  4. moved this from Pending customer to Coming soon in Powertools for AWS Lambda (Python)on Aug 11, 2025
  5. powertools-for-aws-oss-automation commented on Aug 11, 2025

    @powertools-for-aws-oss-automation

    Warning

    This issue is now closed. Please be mindful that future comments are hard for our team to see.
    If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions