open-telemetry / open-telemetry/opentelemetry-python-contrib

sqlalchemy intrument missing operation span

Open
#1,860 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Describe your environment
We are using otel in a lambda with Python3.9, to get the opentelemtry library we are using the otel layer for aws (v1.17/0.38b0) the latest version.

Steps to reproduce
The code implementation is something easy like this

engine = create_engine('teradatasql://')
SQLAlchemyInstrumentor().instrument(
    tracer_provider=tracer_provider,
    engine=engine
)

result = pd.read_sql_query(sql, engine)
engine.dispose()

If I call the lambda the connect span always exists, but sometimes the span with the operation is missing.

What is the expected behavior?
It is expected to always receive the span of the operation performed in the database.

What is the actual behavior?
Currently, the span corresponding to the operation performed in the database is not always received.

Additional context
No additional context to add.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Lambda example using SQLAlchemyInstrumentor.instrument, a Teradata engine, and pandas.read_sql_query, then compare cases where the connection span exists but the operation span is absent. Trace the instrumentation entry points involved in the engine and query call; done means the database operation span is consistently emitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python, sqlalchemy
Domain
databases, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.