feat: implement sandbox_client_discovery_latency_ms metric#381
feat: implement sandbox_client_discovery_latency_ms metric#381chw120 wants to merge 2 commits intokubernetes-sigs:mainfrom
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…y-latency-12171877838811801471
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chw120 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @chw120. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for agent-sandbox canceled.
|
|
/assign @igooch |
|
/ok-to-test |
|
@chw120: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/hold |
Summary
This PR implements the
sandbox_client_discovery_latency_msPrometheus metric for the Python SDK. This metric tracks the time taken for the client to establish a connection to the sandbox, specifically covering Gateway IP assignment (Production mode) orkubectl port-forwardsetup (Developer mode).Note: In addition to the
statuslabel proposed in #245, I have added amodelabel to differentiate between the various discovery mechanisms used.Key Changes
clients/python/agentic-sandbox-client/k8s_agent_sandbox/metrics.pyto define the histogram withstatusandmodelabels.SandboxClient.__enter__insandbox_client.pyto identify and record the discovery mode:gateway: Used when a Gateway Name is provided (Production Mode).port_forward: Used for the default developer mode setup.preconfiguredURLs to avoid skewing discovery data.prometheus-clienttopyproject.toml.test_metrics.pywith parameterized tests to verify that the correctmodeandstatuslabels are applied in different scenarios.test_client.pyto ensure metrics are recorded during standard client initialization.Working on #245.