Skip to content

[BUG] timestamp parameter gets overwritten with execution time on lambda_metric #398

Closed
@TheGBG

Description

@TheGBG

Expected Behavior

When I pass timestamp parameter to datadog_lambda.metric.lambda_metric function, the x-axis (time) of that metric on the monitor should reflect that value passed.

Actual Behavior

The value reflected is the time where the function gets called

Steps to Reproduce the Problem

I am leaving out authentication details as those are handled via env variables on the lambda.

from datadog_lambda.metric import lambda_metric

params = {
            "metric_name": "foo",
            "value": 42,
            "timestamp": 1700748937,  # 2023-11-23 15:16:37
        }
        
lambda_metric(**params)

The code is running on a docker-based lambda. I've passed the timestamp as milliseconds since the epoch, and also as seconds, and none of them seem to affect the x-axis of the monitor.

I am also aware of the following restrictions:

The timestamp associated with the metric value. Note: Metric timestamps cannot be more than ten minutes in the future or more than one hour in the past.

Source

I have also seen that this other issue on the JS API mentions that this functionality is available on Python API.

Specifications

  • Datadog Lambda Layer version: 50
  • Python version: 3.10
  • Base image: public.ecr.aws/lambda/python:3.10
  • Docker extension: public.ecr.aws/datadog/lambda-extension:5
  • Datadog library version: datadog-lambda==4.81.0

Let me know if you need me to provide more code or the Dockerfile. Thanks in advance.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions