-
Couldn't load subscription status.
- Fork 801
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
Conversation
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
|
lgtm @codefromthecrypt |
|
Thanks @alizenhom can you put the skip changelog label on for me? I don't have karma for that |
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!
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-0tox -e py312-test-instrumentation-openai-v2-1Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.