Skip to content

Conversation

lmolkova
Copy link
Member

@lmolkova lmolkova commented Feb 3, 2025

Fixes #3217

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

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

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

I think the owners know after this change we'll get the conversion overhead always, and that can be quite large if there's a large context.

Follow-up notes:

There's little to do about this while we still depend on event_logger. Singe event_logger is deprecated, there's no sense in adding a sampling function to it. Since it could be wrapped, testing if it is noop may have limited benefit.

When things move to a logger base api, it could be possible to optimize this to check if

  • active span is sampled
  • a corresponding log scope is enabled

in either case, do the overhead and when neither, don't.

@lmolkova
Copy link
Member Author

lmolkova commented Feb 3, 2025

I think the owners know after this change we'll get the conversion overhead always, and that can be quite large if there's a large context.

Follow-up notes:

There's little to do about this while we still depend on event_logger. Singe event_logger is deprecated, there's no sense in adding a sampling function to it. Since it could be wrapped, testing if it is noop may have limited benefit.

When things move to a logger base api, it could be possible to optimize this to check if

  • active span is sampled
  • a corresponding log scope is enabled

in either case, do the overhead and when neither, don't.

There are a bunch of spec-level changes in discussions that would make it all possible. For now the best we can do in python is to implement logger.is_enabled that'd return false if logs SDK is not configured - created open-telemetry/opentelemetry-python#4410 to track.

@xrmx xrmx enabled auto-merge (squash) February 6, 2025 13:21
@xrmx xrmx merged commit cca571a into open-telemetry:main Feb 6, 2025
694 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI instrumentation should capture events regardless of span recording

9 participants