Skip to content

Enable tracing only when running on AWS Lambda #572

Closed

Description

@Dunedan

Is your feature request related to a problem? Please describe.

When running code related to an AWS Lambda function outside of AWS Lambda (e.g. when running unit tests or when re-using a function for something else like a CLI script), Tracer with its default configuration fails, as it expects an open X-Ray segment, which usually isn't available in these cases.

That default behavior requires explicitly disabling tracing when not running on AWS Lambda, which is quite annoying and AWS Lambda Powertools could do a better job to simplify things for its users there.

This problem got discussed in detail in #515.

Describe the solution you'd like

I'd like to see a default behavior where tracing is only enabled if the code is running on AWS Lambda.

Describe alternatives you've considered

An alternative to enable tracing only on AWS Lambda could be to let Tracer create a segment if there isn't already one, however I'm not sure about possible side effects.

Activity

  1. added
    feature-request
    triage
    on Jul 29, 2021
  2. heitorlessa commented on Jul 29, 2021

    @heitorlessa
    Contributor
  3. removed
    triage
    on Jul 30, 2021
  4. added this to the 1.19.0 milestone on Jul 30, 2021
  5. michaelbrewer commented on Aug 10, 2021

    @michaelbrewer
    Contributor

    @Dunedan - might be fixed in this PR (#598)

  6. added
    pending-release
    and removed
    pending-release
    on Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-request

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions