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

Feature: ability to inject attributes into sqlalchemy spans to control sampling

Open
#2,788 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What problem do you want to solve?

I use a custom sampler that allows overriding of sampling decisions based on attributes, but I can't use that sampler in the sqlalchemy instrumentor because there is no way to pass attributes.

Describe the solution you'd like

Add an optional 0-argument callable as a kwarg to the instrumentor which lets you inject attributes at sample start time. https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2733

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

Yes

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 with the SQLAlchemy instrumentor and review referenced pull request 2733 for the proposed integration. Trace where spans begin and sampling attributes are established, then add coverage showing that the optional callable's attributes are available at sample start time.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
databases, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.