Skip to content

flush_stats can't be called without a Lambda context #515

Closed
@nr-synth

Description

@nr-synth

Expected Behavior

metric.flush_stats has an optional lambda_context argument, defaulting to None.

Omitting this argument shouldn't cause issues, and didn't in earlier versions of the library.

Actual Behavior

Exception thrown: builtins.UnboundLocalError: local variable 'tags' referenced before assignment

Steps to Reproduce the Problem

  1. metric.flush_stats()

Specifications

  • Datadog Lambda Layer version: v6.98.0
  • Python version: 3.10

Stacktrace

Traceback (most recent call last):
  [...]
  File "/home/lambda/[...]", line 55, in send
    flush_stats()
  File "/home/lambda/datadog_lambda/metric.py", line 136, in flush_stats
    extension_thread_stats.flush(tags)
UnboundLocalError: local variable 'tags' referenced before assignment

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