traceloop / traceloop/openllmetry

🚀 Feature: Enable token usage collection by default for standalone instrumentation

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

Nobody has claimed this yet.

Dominant language
Python
Stars
7.4k
Forks
1.1k
Avg merge
8d 14h
Merged PRs (30d)
2

Description

Which component is this feature for?

All Packages

🔖 Feature description

Related to https://github.com/traceloop/openllmetry/pull/3142#issuecomment-3077362491

Enable enrich_token_usage=True by default so standalone packages like opentelemetry-instrumentation-openai can collect token usage in streaming requests without explicit configuration.

Current Behavior

Standalone: OpenAIInstrumentor().instrument() → No token usage collected (default enrich_token_usage=False)
Traceloop SDK: Traceloop.init() → Token usage collected (explicitly sets enrich_token_usage=True)

Requested Behavior

Standalone instrumentation should collect token usage by default, matching traceloop-sdk behavior.

Proposed Solution

Change default parameter in OpenAIInstrumentor.init() or control this param using environment variables.

enrich_token_usage: bool = True
🎤 Why is this feature needed ?

Better observability out-of-the-box

✌️ How do you aim to achieve this?

Consistent user experience across usage patterns

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request 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!

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 at OpenAIInstrumentor.init() and compare standalone instrumentation with the Traceloop SDK behavior described in the issue. Update the default or environment-variable handling so enrich_token_usage is enabled for standalone use, then verify that streaming requests collect token usage without explicit configuration.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.