Skip to content
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

Python: preprend 'Semantic-Kernel' to User-Agent, and add version key-value pair to headers #5565

Merged
merged 4 commits into from
Mar 20, 2024

Conversation

moonbox3
Copy link
Contributor

Motivation and Context

The SK Python custom headers to track the USER_AGENT and the Python version were getting stuck into the default headers under the USER_AGENT key. Instead, they need to be represented like:

    {
        "UserAgent": HTTP_USER_AGENT,
        "Semantic-Kernel-Version": f"python-{version_info}",
    }

Trying to extract the Python version from telemetry data was not working as expected.

Description

Use the APP_INFO dict as-is, and stick the key-value pairs into the default_headers.

Contribution Checklist

@moonbox3 moonbox3 requested a review from a team as a code owner March 19, 2024 22:27
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Mar 19, 2024
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Mar 19, 2024

Py3.8 Test Coverage

Python 3.8 Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel/connectors/ai/open_ai/services
   azure_config_base.py34294%80, 96
   open_ai_config_base.py32197%56
TOTAL5399101281% 

Python 3.8 Unit Test Overview

Tests Skipped Failures Errors Time
1205 11 💤 0 ❌ 0 🔥 21.930s ⏱️

@moonbox3 moonbox3 changed the title Python: use the telemetry app data dict key value pairs as-is instead of merging to one dict key Python: preprend 'Semantic-Kernel' to User-Agent, and add version key-value pair to headers Mar 19, 2024
Copy link
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@juliomenendez juliomenendez left a comment

Choose a reason for hiding this comment

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

LGTM

@moonbox3 moonbox3 added this pull request to the merge queue Mar 20, 2024
Merged via the queue into microsoft:main with commit 9924aff Mar 20, 2024
30 checks passed
@moonbox3 moonbox3 deleted the update_py_telemetry_headers branch March 20, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants