Add Confluent-Client-Version header to requests to SR, Python client#2148
Add Confluent-Client-Version header to requests to SR, Python client#2148Naxin Fang (fangnx) merged 6 commits intomasterfrom
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
This PR adds a Confluent-Client-Version header to all requests sent to Schema Registry to identify the Python client version being used.
Key Changes:
- Import the
versionfunction from theconfluent_kafkapackage - Add
Confluent-Client-Versionheader with formatpython/{version()}to request headers
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/confluent_kafka/schema_registry/_sync/schema_registry_client.py | Adds version import and Confluent-Client-Version header to synchronous Schema Registry client |
| src/confluent_kafka/schema_registry/_async/schema_registry_client.py | Adds version import and Confluent-Client-Version header to asynchronous Schema Registry client |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'Content-Length': str(len(body_str)), | ||
| 'Content-Type': "application/vnd.schemaregistry.v1+json", | ||
| 'Confluent-Accept-Unknown-Properties': "true", | ||
| 'Confluent-Client-Version': f"python/{version()}" |
There was a problem hiding this comment.
The version() function is called on every request. Consider caching the version string at the class or module level to avoid repeated function calls, especially if the version is unlikely to change during runtime.
| 'Content-Length': str(len(body_str)), | ||
| 'Content-Type': "application/vnd.schemaregistry.v1+json", | ||
| 'Confluent-Accept-Unknown-Properties': "true", | ||
| 'Confluent-Client-Version': f"python/{version()}" |
There was a problem hiding this comment.
The version() function is called on every request. Consider caching the version string at the class or module level to avoid repeated function calls, especially if the version is unlikely to change during runtime.
17bf7da to
6c8687c
Compare
|
83ef128 to
dd07310
Compare
Robert Yokota (rayokota)
left a comment
There was a problem hiding this comment.
Thanks Naxin Fang (@fangnx) , LGTM
|




What
Checklist
References
JIRA: https://confluentinc.atlassian.net/browse/DGS-22770
Test & Review
Open questions / Follow-ups