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

Create a python autoinstrumentor

Open
#3,566 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello all,

It would be convenient to have a python autoinstrumentor, which would create a new span for each function, add inputs and outputs of functions as attributes etc...
I would just call PythonInstrumentor.instrument() and I would receive the traces for all function calls and returns in my collector.

There might be different ways to do that, the first easy way I see is to use the sys.monitoring to start a span on function calls and terminate them on function returns

Questions:

  • Does a python autoinstrumentor like this already exist ?
  • If it does not exist, why is it a bad idea ?

Also do you see reasons why it would be a bad idea to implement this python instrumentor using sys.monitoring ?

Thank you for your responses

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 reviewing the proposed PythonInstrumentor.instrument() API and Python's sys.monitoring function-call and return events. Check whether an equivalent autoinstrumentor already exists, then assess the scope and trade-offs of creating spans with function inputs and outputs. Done requires a decided implementation direction and defined behavior, which this issue does not currently specify.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.