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

feat: requests to remote always include user-agent #21684

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/python/pants/option/global_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def from_options(
process_per_child_memory_usage=bootstrap_options.process_per_child_memory_usage,
# Remote store setup.
remote_store_address=dynamic_remote_options.store_address,
remote_store_headers=dynamic_remote_options.store_headers,
remote_store_headers=cls.with_user_agent(dynamic_remote_options.store_headers),
remote_store_chunk_bytes=bootstrap_options.remote_store_chunk_bytes,
remote_store_rpc_retries=bootstrap_options.remote_store_rpc_retries,
remote_store_rpc_concurrency=dynamic_remote_options.store_rpc_concurrency,
Expand All @@ -691,12 +691,16 @@ def from_options(
remote_cache_rpc_timeout_millis=bootstrap_options.remote_cache_rpc_timeout_millis,
# Remote execution setup.
remote_execution_address=dynamic_remote_options.execution_address,
remote_execution_headers=dynamic_remote_options.execution_headers,
remote_execution_headers=cls.with_user_agent(dynamic_remote_options.execution_headers),
remote_execution_overall_deadline_secs=bootstrap_options.remote_execution_overall_deadline_secs,
remote_execution_rpc_concurrency=dynamic_remote_options.execution_rpc_concurrency,
remote_execution_append_only_caches_base_path=bootstrap_options.remote_execution_append_only_caches_base_path,
)

@classmethod
def with_user_agent(cls, headers: dict[str, str]) -> dict[str, str]:
return {"user-agent": f"pants/{VERSION}"} | headers


@dataclass(frozen=True)
class LocalStoreOptions:
Expand Down Expand Up @@ -766,9 +770,7 @@ def from_options(cls, options: OptionValueContainer) -> LocalStoreOptions:
process_execution_graceful_shutdown_timeout=3,
# Remote store setup.
remote_store_address=None,
remote_store_headers={
"user-agent": f"pants/{VERSION}",
},
remote_store_headers={},
remote_store_chunk_bytes=1024 * 1024,
remote_store_rpc_retries=2,
remote_store_rpc_concurrency=128,
Expand All @@ -780,9 +782,7 @@ def from_options(cls, options: OptionValueContainer) -> LocalStoreOptions:
remote_cache_rpc_timeout_millis=1500,
# Remote execution setup.
remote_execution_address=None,
remote_execution_headers={
"user-agent": f"pants/{VERSION}",
},
remote_execution_headers={},
remote_execution_overall_deadline_secs=60 * 60, # one hour
remote_execution_rpc_concurrency=128,
remote_execution_append_only_caches_base_path=None,
Expand Down