-
Notifications
You must be signed in to change notification settings - Fork 690
opentelemetry-instrumentation-openai-v2: scrub cookie from tests #2993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This scrubs test data and rewords token replacements corresponding to canonical ENV variables.o Before, we had inconsistent test data where most sensitive properties were set, but not all. Also, we scrubbed "api-key", but that is only set when using `AzureClient`, which this package doesn't use, yet. When it does, we should probably scrub more. The main thing this does is scrub out the request cookie, so that folks don't accidentally leak it in new PRs. After that, it helps clarify the source of sensitive data by making the replacement tokens match naming conventions of OpenAI ENV variables. See https://github.com/openai/openai-python/blob/646a579cdb305a9d3fba6c5f9a96011c5e2c2882/src/openai/_client.py#L98-L100 Signed-off-by: Adrian Cole <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notes
...ry-instrumentation-openai-v2/tests/cassettes/test_chat_completion_tool_calls_no_content.yaml
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py
Show resolved
Hide resolved
8 tasks
lgtm @codefromthecrypt |
alizenhom
approved these changes
Nov 11, 2024
Thanks @alizenhom can you put the skip changelog label on for me? I don't have karma for that |
karthikscale3
approved these changes
Nov 12, 2024
xrmx
approved these changes
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
xrmx
pushed a commit
to xrmx/opentelemetry-python-contrib
that referenced
this pull request
Jan 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This scrubs test data and rewords token replacements corresponding to canonical ENV variables.
Before, we had inconsistent test data where most sensitive properties were scrubbed, but not all. The main thing this does is scrub out the request cookie, so that folks don't accidentally leak it in new PRs. After that, it helps clarify the source of sensitive data by making the replacement tokens match naming conventions of OpenAI ENV variables.
Also, before we scrubbed "api-key", but that is only set when using
AzureClient
, which this package doesn't use, yet. When it does, we should probably scrub more (as the URLs include sensitive project-specific details). If we end up supportingAzureClient
, I can help in the scrub config for that.Noticed the cookie problem in #2984
See https://github.com/openai/openai-python/blob/646a579cdb305a9d3fba6c5f9a96011c5e2c2882/src/openai/_client.py#L98-L100
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I deleted all test yaml and ran the test two ways to make sure it recreates correctly, with no cookies in the yaml
tox -e py312-test-instrumentation-openai-v2-0
tox -e py312-test-instrumentation-openai-v2-1
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.