Skip to content

Metrics sent via sendDistributionMetric delayed by several minutes #581

@ribaptista

Description

@ribaptista

Expected Behavior

I expect the metric values sent via sendDistributionMetric to be immediately reflected in Datadog, without delays. The sum of the values should match what is sent during the Lambda invocations in real time.

Actual Behavior

The metric values are delayed in Datadog and do not appear immediately after they are sent. For example, after 100 invocations of my Lambda function, the sum should be 500 (5 per invocation). However, the sum is roughly 475, and the remaining 25 appears several minutes later in Datadog, associated with a later timestamp, not the time the metrics were actually emitted.

Is there a way to force the Lambda function to flush metrics immediately after each invocation?

Steps to Reproduce the Problem

Set up a Lambda function with serverless-plugin-datadog version 5.83.0 and configure the following environment variables:

DD_TRACE_OTEL_ENABLED: false
DD_PROFILING_ENABLED: false
DD_SERVERLESS_APPSEC_ENABLED: false

Import datadog-lambda-js in your Lambda function and call sendDistributionMetric after each invocation.
Observe that the sum of the metrics in Datadog does not immediately match the values sent, and there is a delay in the appearance of the missing values, which appear several minutes later.

Specifications

Serverless Framework version: 3.39.0
Datadog Serverless Plugin version: 5.83.0
Lambda function runtime: nodejs20.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions