Skip to content

fix: preserve telemetry function metadata with functools.wraps#11617

Closed
santino18727-debug wants to merge 1 commit into
deepset-ai:mainfrom
santino18727-debug:fix/telemetry-functools-wraps-11568
Closed

fix: preserve telemetry function metadata with functools.wraps#11617
santino18727-debug wants to merge 1 commit into
deepset-ai:mainfrom
santino18727-debug:fix/telemetry-functools-wraps-11568

Conversation

@santino18727-debug

Copy link
Copy Markdown

Related Issues

Fixes #11568

Proposed Changes

The send_telemetry decorator wrapped functions like pipeline_running and tutorial_running without functools.wraps, so the decorated functions lost their original metadata (__name__, __doc__, __annotations__). This makes stack traces and generated API docs confusing.

The old # FIXME comment claimed that functools.wraps put the global telemetry object "out of scope". That concern is incorrect: the global is resolved at call time, not at decoration time. (The original author most likely hit a NameError because functools was not imported.)

This change imports functools, applies @functools.wraps(func) to the wrapper, and removes the obsolete comment.

How did you test it?

Added a unit test asserting pipeline_running.__name__ and __doc__ are preserved. Existing telemetry tests pass.

Notes for the reviewer

Includes a release note. Prepared with the assistance of an AI agent; reviewed and verified locally (tests + ruff).

…et-ai#11568)

The `send_telemetry` decorator did not use `functools.wraps`, so decorated
functions lost their `__name__`, `__doc__`, and `__annotations__`. The old
`# FIXME` comment claimed `functools.wraps` made `telemetry` "out of scope",
but the global `telemetry` is resolved at call time, not decoration time, so
wrapping is safe. Add `functools.wraps`, import `functools`, and drop the FIXME.
@santino18727-debug santino18727-debug requested a review from a team as a code owner June 13, 2026 06:13
@santino18727-debug santino18727-debug requested review from sjrl and removed request for a team June 13, 2026 06:13
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@santino18727-debug is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Jun 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sjrl sjrl requested a review from julian-risch June 15, 2026 04:47
@julian-risch julian-risch removed the request for review from sjrl June 15, 2026 07:30
@julian-risch

Copy link
Copy Markdown
Member

Thank you for opening this PR @santino18727-debug . There was already another PR open that addresses the same issue and that one got merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: telemetry decorator overwrites original function metadata

3 participants