Skip to content

Add reasoning tokens attribute to span / log when new sem conv is set#4493

Merged
lzchen merged 4 commits intoopen-telemetry:mainfrom
DylanRussell:add_reasoning_token_attr
Apr 30, 2026
Merged

Add reasoning tokens attribute to span / log when new sem conv is set#4493
lzchen merged 4 commits intoopen-telemetry:mainfrom
DylanRussell:add_reasoning_token_attr

Conversation

@DylanRussell
Copy link
Copy Markdown
Contributor

@DylanRussell DylanRussell commented Apr 27, 2026

Description

Adds the reasoning token attribute defined in https://github.com/open-telemetry/semantic-conventions/pull/3383/changes to spans / logs when the new semconv flag is set.

Also adds reasoning tokens to output tokens as per the sem conv..

Fixes #3890

Type of change

Please delete options that are not relevant.

  • [x ] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • [ x] No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [ x] Followed the style guidelines of this project
  • [ x] Changelogs have been updated
  • [ x] Unit tests have been added
  • [ x] Documentation has been updated

Copy link
Copy Markdown
Contributor

@herin049 herin049 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Apr 29, 2026
@lzchen lzchen added the gen-ai Related to generative AI label Apr 30, 2026
Copy link
Copy Markdown
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Are there plans on moving this instrumentation to use TelemetryHandler in genai utils? We could probably add reason_tokens to InferenceInvocation too (separate pr).

@DylanRussell
Copy link
Copy Markdown
Contributor Author

Yeah I can take a stab at moving it over sometime in the next week

@lzchen
Copy link
Copy Markdown
Contributor

lzchen commented Apr 30, 2026

Oh looks like you did identify this as a duplicate of #4206, @DylanRussell please let us know what you decide to do here :)

@DylanRussell
Copy link
Copy Markdown
Contributor Author

Yeah I think lets just merge this one and close the other ones.. it doesn't really matter tho, they are identical

@lzchen lzchen merged commit 1f198d7 into open-telemetry:main Apr 30, 2026
752 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gen-ai Related to generative AI

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Google GenAI instrumentation needs to count thinking tokens

4 participants