Skip to content

🐛 Bug Report: TRACELOOP_TRACING_ENABLED does not match Traceloop.init(enabled) parameter behavior #4191

Description

@camille-vanhoffelen

Which component is this bug for?

Traceloop SDK

📜 Description

Traceloop.init(enabled=False) works as a no-op setting. Any subsequent call on instrumented methods are silently skipped.

TRACELOOP_TRACING_ENABLED=false does not work in the same way. E.g calling methods that are decorated with @workflow() yields error logs.

👟 Reproduction steps

  1. set TRACELOOP_TRACING_ENABLED=false
  2. run Traceloop.init()
  3. run:
from traceloop.sdk.decorators import workflow

@workflow(name="hello-world")
def hello_world():
    return "hello world!"

hello_world()

👍 Expected behavior

  1. printed "Traceloop instrumentation is disabled via init flag"

  2. nothing

👎 Actual Behavior with Screenshots

  1. printed "Tracing is disabled"

  2. printed "Warning: Traceloop not initialized, make sure you call Traceloop.init()"

🤖 Python Version

3.12

📃 Provide any additional context for the Bug.

Probably related to the two different ways of handling disabled in these lines.

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions