Skip to content

Sqlalchemy uninstrument function doesnt work as expected  #1163

@liorzmetis

Description

@liorzmetis

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version: 3.9

Steps to reproduce
Just create a SQLAlchemy instrumentation and call uninstrument function
Example:

db_url = os.environ['DATABASE_URI']

engine = create_engine(db_url)

instrumentation = SQLAlchemyInstrumentor()
instrumentation.instrument(
    engine=engine
)

def set_interval(func, sec):
    def func_wrapper():
        # set_interval(func, sec)
        func()

    t = threading.Timer(sec, func_wrapper)
    t.start()
    return t


def instrument():
    print("instrument")
    instrumentation.instrument_app(app, engine)


def uninstrument():
    print("uninstrument")
    instrumentation.uninstrument()


set_interval(instrument, 1)
set_interval(uninstrument, 20)

What is the expected behavior?
Don't collect spans

What is the actual behavior?
Still recording and collecting spans

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions