Repository navigation
feat: send attributable User-Agent on REST and OAuth requests (backport #477 to stable/9) - #479
Merged
Merged
Conversation
#477 to stable/9) Backport of #477 (cherry picked from commit be03747), ported by hand. stable/9 has no runtime/cluster_admin_url.py, so user_agent.py carries its own HttpxArgs, RequestHook and append_request_hook, and the OAuth providers take no clock argument. There is no escape-hatch baseline on stable/9.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The review reports no active issues with the User-Agent attribution backport.
No open issues 🎉
What changed in this PR
Backports attributable User-Agent headers to stable/9, allowing gateway usage reports to identify Python SDK traffic on REST and OAuth requests.
Changes:
- Adds versioned SDK identification for synchronous and asynchronous clients, including direct low-level client use.
- Adds
CAMUNDA_USER_AGENTconfiguration and preserves caller-supplied application headers after the SDK identifier. - Updates acceptance coverage, documentation, generated code, and stubs; removes the ignored generator setting.
| File | Description |
|---|---|
tests/acceptance/test_user_agent.py |
Tests REST attribution, suffix preservation, hook conversion, and idempotency. |
tests/acceptance/test_pluggable_auth.py |
Tests OAuth User-Agent defaults and application suffixes. |
stubs/camunda_orchestration_sdk/runtime/user_agent.pyi |
Adds types for User-Agent helpers and hooks. |
stubs/camunda_orchestration_sdk/runtime/configuration_resolver.pyi |
Exposes the application User-Agent setting. |
stubs/camunda_orchestration_sdk/runtime/auth.pyi |
Adds optional User-Agent parameters to OAuth providers. |
stubs/camunda_orchestration_sdk/client.pyi |
Reflects low-level client initialization hooks. |
runtime/user_agent.py |
Implements version lookup, header composition, and request hooks. |
runtime/configuration_resolver.py |
Registers and documents CAMUNDA_USER_AGENT. |
runtime/auth.py |
Sets attributable headers on OAuth token clients. |
README.md |
Documents the application User-Agent setting. |
hooks/post_gen/0900_flatten_client.py |
Injects User-Agent support into generated clients. |
generator-config.yaml |
Removes the ignored httpUserAgent setting. |
generated/camunda_orchestration_sdk/runtime/user_agent.py |
Includes generated User-Agent runtime helpers. |
generated/camunda_orchestration_sdk/runtime/configuration_resolver.py |
Includes the new configuration setting. |
generated/camunda_orchestration_sdk/runtime/auth.py |
Includes OAuth User-Agent support. |
generated/camunda_orchestration_sdk/client.py |
Wires headers and hooks into generated clients. |
Review effort: Balanced
…luster-api-python into backport-477-to-stable/9
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
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.
Backport of #477 to
stable/9, ported by hand. This repo has no backport workflow yet (#460 is still open).What differs from main:
runtime/cluster_admin_url.py, soruntime/user_agent.pydefines its ownHttpxArgs,RequestHookandappend_request_hook(copied from main's version).clockparameter, souser_agentcomes afterlogger.How it was built:
generated/andstubs/were regenerated on stable/9 in a separatechore(gen)commit.generated/bundled_spec.yamlwas left as committed. Regenerating it on stable/9 only reshufflesrequiredlists, which is the nondeterminism that fix(gen): sort merged required lists so stable/9 generation is deterministic #457 fixes, and isn't part of this change.Tested locally:
make test(acceptance): 408 passed.tests/unit: 80 passed.relates to #476