Skip to content

🐛 Bug Report: Errors are not logged #412

Closed

Description

@nirga

Which component is this bug for?

All Packages

📜 Description

If an HTTP error is returned from a foundation model API, we don't properly log it as a failed span.

👟 Reproduction steps

N/A

👍 Expected behavior

N/A

👎 Actual Behavior with Screenshots

N/A

🤖 Python Version

No response

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

Activity

  1. added
    good first issue
    help wanted
    on Feb 8, 2024
  2. HappyLife2 commented on Feb 25, 2024

    @HappyLife2

    Hi @nirga. Could you specify which components or packages within the project interact directly with foundation model APIs? This information will help narrow down the search to the relevant parts of the codebase.

    Also, could you provide insight into how a 'failed span' is defined or identified within the context of the project? This will aid in accurately logging the relevant events as failed spans.

  3. nirga commented on Feb 26, 2024

    @nirga
    MemberAuthor

    Hey @HappyLife2!
    These are opentelemetry-instrumentatin-openai, -anthropic, -cohere, -replicate, -bedrock, -vertexai and -transformers.

    This is how a failed span should be logged: https://opentelemetry.io/docs/languages/python/instrumentation/#record-exceptions-in-spans

  4. epg323 commented on May 2, 2024

    @epg323

    I can be assigned to this one if no one wants it.

  5. nirga commented on May 2, 2024

    @nirga
    MemberAuthor

    That would be great @epg323 :)
    I assume @HappyLife2 is not actively working on this since it's been 2 months.

  6. akhilk2802 commented on Jul 3, 2024

    @akhilk2802

    Is the issue still open ?

  7. nirga commented on Jul 3, 2024

    @nirga
    MemberAuthor

    Yes @akhilk2802! Appreciate any help :)

  8. akhilk2802 commented on Jul 6, 2024

    @akhilk2802

    okay, looking into it

  9. Huzaifa666 commented on Jul 20, 2024

    @Huzaifa666

    Is this issue still open or resolved ?

  10. nirga commented on Jul 20, 2024

    @nirga
    MemberAuthor

    Yes this is still open, not sure what's the status of @akhilk2802 though

  11. Huzaifa666 commented on Jul 20, 2024

    @Huzaifa666

    Hey @nirga

    I was able to setup a sample project and can see the spans in my dashboard
    Screenshot from 2024-07-20 23-20-42

    I produced a 401 error code by inputting incorrect API_KEY

    Screenshot from 2024-07-20 23-23-54

    You want this error to be logged as a span
    Correct me if I am wrong here

  12. nirga commented on Jul 20, 2024

    @nirga
    MemberAuthor

    Exactly @Huzaifa666!

  13. Huzaifa666 commented on Jul 20, 2024

    @Huzaifa666

    Screenshot from 2024-07-20 23-51-53

    Is this acceptable ?
    Was able to show the error in the logged span
    @nirga

  14. nirga commented on Jul 20, 2024

    @nirga
    MemberAuthor

    Looks good, let's look at the code

  15. 4 remaining items

  16. nirga commented on Jan 20, 2025

    @nirga
    MemberAuthor

    @jareks any specific pacakges / instrumentation you'd like us to prioritize?

  17. jareks commented on Jan 20, 2025

    @jareks

    Exceptions from openai client would be great 👍

  18. apthaks commented on Feb 11, 2025

    @apthaks

    Any update on langchain?

  19. nirga commented on Feb 19, 2025

    @nirga
    MemberAuthor

    @apthagowda97 we're adding this now! Sorry for the delay here

  20. shristirwt commented on Oct 21, 2025

    @shristirwt

    Hi @nirga ,
    This issue is still open and I would like to help. I see that PRs for openai and langchain have already been merged.
    I can take on one of the remaining packages. Would it be helpful if I started with opentelemetry-instrumentation-cohere (or pick another one from the list)?
    Please let me know!

  21. nirga commented on Oct 21, 2025

    @nirga
    MemberAuthor

    Yes that would be perfect @shristirwt

  22. shristirwt commented on Oct 27, 2025

    @shristirwt

    Hi @nirga ,
    I've finished the changes locally to fix the error logging for the cohere package. I've added try...except...finally blocks to the streaming functions and fixed the async wrapper. I also added new unit tests for the error paths, and all tests for the package are passing.

    Since this PR only fixes the issue for cohere (and the original issue #412 covers multiple packages), should I open the Pull Request linked to #412, or would you prefer I create a new, separate issue specifically for the cohere fix and link the PR to that?

    Let me know!

  23. nirga commented on Oct 29, 2025

    @nirga
    MemberAuthor

    Small PRs are always better :) @shristirwt

  24. DDiyash commented on Dec 24, 2025

    @DDiyash

    Hey @nirga, I see that the issue is still open, I’d like to take on opentelemetry-instrumentation-anthropic. Could you assign this issue to me?

  25. srijansingh9170-source commented on Mar 31, 2026

    @srijansingh9170-source

    Hi, I would like to work on this issue. Could you please assign it to me?

  26. added a commit that references this issue on Apr 10, 2026
    fa7e018
  27. added 2 commits that reference this issue on Apr 16, 2026
    7bc681e
    69e73ec
  28. added a commit that references this issue on Apr 17, 2026
    3146258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions