langgraph-cli 0.4.41__tar.gz → 0.4.42__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/PKG-INFO +66 -1
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/README.md +65 -0
- langgraph_cli-0.4.42/langgraph_cli/__init__.py +1 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/deploy.py +78 -1
- langgraph_cli-0.4.42/langgraph_cli/deployment_metrics.py +95 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/host_backend.py +7 -0
- langgraph_cli-0.4.42/tests/unit_tests/cli/test_deploy_monitoring.py +166 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/conftest.py +7 -0
- langgraph_cli-0.4.42/tests/unit_tests/deployment_metrics.json +215 -0
- langgraph_cli-0.4.42/tests/unit_tests/test_deployment_metrics.py +139 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv.lock +221 -145
- langgraph_cli-0.4.41/langgraph_cli/__init__.py +0 -1
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/.gitignore +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/LICENSE +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/Makefile +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/.env.example +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/.gitignore +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/Makefile +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs/deps/additional_deps/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs/deps/zuper_deps/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs_fail/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs_fail/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graph_prerelease_reqs_fail/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs/storm.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/graphs_submod/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/graphs_submod/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/graphs_submod/subprompt.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/hello.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/prompt.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_a/requirements.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/graphs_submod/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/graphs_submod/subprompt.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/hello.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/prompt.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/requirements.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/utils/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/graphs_reqs_b/utils/greeter.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/my_app.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/pipconf.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/examples/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/generate_schema.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/.dockerignore +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/.editorconfig +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/.env.example +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/.eslintrc.cjs +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/.gitignore +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/LICENSE +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/README.md +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/jest.config.js +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/package.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/src/agent/graph.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/src/agent/state.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/static/studio.png +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/tests/agent.test.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/tests/graph.int.test.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/tsconfig.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-examples/yarn.lock +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/.eslintrc.cjs +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/apps/agent/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/apps/agent/package.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/apps/agent/src/graph.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/apps/agent/src/state.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/apps/agent/tsconfig.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/libs/shared/package.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/libs/shared/src/index.ts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/libs/shared/tsconfig.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/package.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/tsconfig.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/turbo.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/js-monorepo-example/yarn.lock +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/__main__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/_ignore.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/analytics.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/archive.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/cli.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/config.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/constants.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/dependency_tracking.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/docker.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/exec.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/image_reference.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/progress.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/py.typed +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/schemas.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/templates.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/util.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/uv_lock.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/langgraph_cli/version.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/apps/agent/.env.example +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/apps/agent/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/apps/agent/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/apps/agent/src/agent/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/apps/agent/src/agent/graph.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/apps/agent/src/agent/state.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/libs/common/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/libs/common/helpers.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/libs/shared/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/libs/shared/src/shared/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/libs/shared/src/shared/utils.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/python-monorepo-example/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/schemas/schema.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/schemas/schema.v0.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/schemas/version.schema.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/integration_tests/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/integration_tests/test_cli.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/cli/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/cli/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/cli/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/cli/test_cli.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/cli/test_deploy_command.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/cli/test_templates.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/graphs/agent.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/helpers.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/multiplatform/js.mts +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/multiplatform/python.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/pipconfig.txt +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_archive.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_config.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_config.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_dependency_tracking.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_deploy_agents.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_deploy_helpers.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_docker.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_exec.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_host_backend.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_image_reference.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_logs_helpers.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/tests/unit_tests/test_util.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/apps/agent/.env.example +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/apps/agent/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/apps/agent/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/apps/agent/src/agent/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/apps/agent/src/agent/graph.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/libs/shared/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/libs/shared/src/shared/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/libs/shared/src/shared/utils.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/monorepo/uv.lock +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/simple/.env.example +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/simple/langgraph.json +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/simple/pyproject.toml +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/simple/src/agent/__init__.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/simple/src/agent/graph.py +0 -0
- {langgraph_cli-0.4.41 → langgraph_cli-0.4.42}/uv-examples/simple/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: langgraph-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.42
|
|
4
4
|
Summary: CLI for interacting with LangGraph API
|
|
5
5
|
Project-URL: Source, https://github.com/langchain-ai/langgraph/tree/main/libs/cli
|
|
6
6
|
Project-URL: Twitter, https://x.com/langchain_oss
|
|
@@ -108,6 +108,71 @@ langgraph dockerfile SAVE_PATH [OPTIONS]
|
|
|
108
108
|
-c, --config FILE Config file path
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
### `langgraph deploy metrics`
|
|
112
|
+
|
|
113
|
+
Fetch deployment monitoring time series as JSON through the LangSmith control plane.
|
|
114
|
+
Use `langgraph deploy list` to find the deployment ID. Authentication uses the same
|
|
115
|
+
API key and workspace configuration as the other deployment commands.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
langgraph deploy metrics DEPLOYMENT_ID \
|
|
119
|
+
--start-time 2026-10-28T00:00:00Z \
|
|
120
|
+
--end-time 2026-10-28T01:00:00Z \
|
|
121
|
+
--metrics cpu_usage,memory_usage,worker_count
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`--metrics` accepts a comma-separated list of these names (also listed in
|
|
125
|
+
`langgraph deploy metrics --help`):
|
|
126
|
+
|
|
127
|
+
- Resource usage: `memory_usage`, `cpu_usage`, `disk_usage`
|
|
128
|
+
- Counts: `restart_count`, `replica_count`, `worker_count`, `lg_run_count`
|
|
129
|
+
- HTTP traffic: `responses_per_second`, `error_responses_per_second`, `p95_latency`
|
|
130
|
+
- Queue: `run_queue_wait_time`
|
|
131
|
+
|
|
132
|
+
These are exact metric names, not free-text search terms. Availability depends on
|
|
133
|
+
the deployment and platform; a supported metric may have no data. Use
|
|
134
|
+
`lg_run_count` for deployment runs, not the UI schema's placeholder `run_count`.
|
|
135
|
+
|
|
136
|
+
Omit `--metrics` to fetch all available metrics. Time bounds default to the last
|
|
137
|
+
15 minutes, and the backend picks the resolution from the time
|
|
138
|
+
range. This command never prompts; for an organization-scoped key, set
|
|
139
|
+
`LANGSMITH_TENANT_ID` to the workspace ID.
|
|
140
|
+
|
|
141
|
+
Default output is compact JSON grouped by section title, chart title, and series
|
|
142
|
+
name. Each series contains its real `project_metric` as `metric`, inferred `unit`
|
|
143
|
+
(`percent`, `count`, or `null`), `latest`, `min`, `max`, `avg`, and
|
|
144
|
+
`points: [[iso_timestamp, value], ...]`. Values are rounded to three decimals;
|
|
145
|
+
statistics use unrounded finite values and ignore missing samples. `latest` is
|
|
146
|
+
the latest non-missing value. Missing samples remain `null` gaps, and series with
|
|
147
|
+
no values have null statistics. Empty sections are marked `{"_empty":true}`.
|
|
148
|
+
|
|
149
|
+
The top level includes `deployment_id`, `start_time`, `end_time`, and
|
|
150
|
+
`step_seconds`. Bounds always describe the requested window, not the observed
|
|
151
|
+
point bounds. The CLI resolves omitted bounds once: end defaults to now (UTC),
|
|
152
|
+
and start defaults to 15 minutes before the resolved end. With only `--end-time`,
|
|
153
|
+
start is 15 minutes before that value; with only `--start-time`, end is now. Both
|
|
154
|
+
values are sent explicitly to the backend and output, even when there are no points. `step_seconds` is the most common gap between consecutive
|
|
155
|
+
timestamps within series, with ties broken by the smallest gap. Whole seconds
|
|
156
|
+
are integers; fractional seconds are preserved. It is `null` only when every
|
|
157
|
+
series has fewer than two timestamps. UI metadata and repeated series IDs are
|
|
158
|
+
omitted. The host-backend response itself is unchanged.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
langgraph deploy metrics DEPLOYMENT_ID --summary
|
|
162
|
+
langgraph deploy metrics DEPLOYMENT_ID --raw
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`--summary` returns the same shape without `points`. `--raw` returns the original
|
|
166
|
+
UI chart schema without reshaping or rounding. These flags are mutually exclusive.
|
|
167
|
+
Neither mode returns traces.
|
|
168
|
+
|
|
169
|
+
Size comparison using the realistic synthetic unit-test fixture (compact JSON
|
|
170
|
+
serialization for all modes; not a live deployment benchmark):
|
|
171
|
+
|
|
172
|
+
| Before: raw UI schema | After: default | After: summary |
|
|
173
|
+
| --- | --- | --- |
|
|
174
|
+
| 4,302 bytes | 1,226 bytes (72% smaller) | 806 bytes (81% smaller) |
|
|
175
|
+
|
|
111
176
|
## Configuration
|
|
112
177
|
|
|
113
178
|
The CLI uses a `langgraph.json` configuration file with these key settings:
|
|
@@ -86,6 +86,71 @@ langgraph dockerfile SAVE_PATH [OPTIONS]
|
|
|
86
86
|
-c, --config FILE Config file path
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
+
### `langgraph deploy metrics`
|
|
90
|
+
|
|
91
|
+
Fetch deployment monitoring time series as JSON through the LangSmith control plane.
|
|
92
|
+
Use `langgraph deploy list` to find the deployment ID. Authentication uses the same
|
|
93
|
+
API key and workspace configuration as the other deployment commands.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
langgraph deploy metrics DEPLOYMENT_ID \
|
|
97
|
+
--start-time 2026-10-28T00:00:00Z \
|
|
98
|
+
--end-time 2026-10-28T01:00:00Z \
|
|
99
|
+
--metrics cpu_usage,memory_usage,worker_count
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`--metrics` accepts a comma-separated list of these names (also listed in
|
|
103
|
+
`langgraph deploy metrics --help`):
|
|
104
|
+
|
|
105
|
+
- Resource usage: `memory_usage`, `cpu_usage`, `disk_usage`
|
|
106
|
+
- Counts: `restart_count`, `replica_count`, `worker_count`, `lg_run_count`
|
|
107
|
+
- HTTP traffic: `responses_per_second`, `error_responses_per_second`, `p95_latency`
|
|
108
|
+
- Queue: `run_queue_wait_time`
|
|
109
|
+
|
|
110
|
+
These are exact metric names, not free-text search terms. Availability depends on
|
|
111
|
+
the deployment and platform; a supported metric may have no data. Use
|
|
112
|
+
`lg_run_count` for deployment runs, not the UI schema's placeholder `run_count`.
|
|
113
|
+
|
|
114
|
+
Omit `--metrics` to fetch all available metrics. Time bounds default to the last
|
|
115
|
+
15 minutes, and the backend picks the resolution from the time
|
|
116
|
+
range. This command never prompts; for an organization-scoped key, set
|
|
117
|
+
`LANGSMITH_TENANT_ID` to the workspace ID.
|
|
118
|
+
|
|
119
|
+
Default output is compact JSON grouped by section title, chart title, and series
|
|
120
|
+
name. Each series contains its real `project_metric` as `metric`, inferred `unit`
|
|
121
|
+
(`percent`, `count`, or `null`), `latest`, `min`, `max`, `avg`, and
|
|
122
|
+
`points: [[iso_timestamp, value], ...]`. Values are rounded to three decimals;
|
|
123
|
+
statistics use unrounded finite values and ignore missing samples. `latest` is
|
|
124
|
+
the latest non-missing value. Missing samples remain `null` gaps, and series with
|
|
125
|
+
no values have null statistics. Empty sections are marked `{"_empty":true}`.
|
|
126
|
+
|
|
127
|
+
The top level includes `deployment_id`, `start_time`, `end_time`, and
|
|
128
|
+
`step_seconds`. Bounds always describe the requested window, not the observed
|
|
129
|
+
point bounds. The CLI resolves omitted bounds once: end defaults to now (UTC),
|
|
130
|
+
and start defaults to 15 minutes before the resolved end. With only `--end-time`,
|
|
131
|
+
start is 15 minutes before that value; with only `--start-time`, end is now. Both
|
|
132
|
+
values are sent explicitly to the backend and output, even when there are no points. `step_seconds` is the most common gap between consecutive
|
|
133
|
+
timestamps within series, with ties broken by the smallest gap. Whole seconds
|
|
134
|
+
are integers; fractional seconds are preserved. It is `null` only when every
|
|
135
|
+
series has fewer than two timestamps. UI metadata and repeated series IDs are
|
|
136
|
+
omitted. The host-backend response itself is unchanged.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
langgraph deploy metrics DEPLOYMENT_ID --summary
|
|
140
|
+
langgraph deploy metrics DEPLOYMENT_ID --raw
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`--summary` returns the same shape without `points`. `--raw` returns the original
|
|
144
|
+
UI chart schema without reshaping or rounding. These flags are mutually exclusive.
|
|
145
|
+
Neither mode returns traces.
|
|
146
|
+
|
|
147
|
+
Size comparison using the realistic synthetic unit-test fixture (compact JSON
|
|
148
|
+
serialization for all modes; not a live deployment benchmark):
|
|
149
|
+
|
|
150
|
+
| Before: raw UI schema | After: default | After: summary |
|
|
151
|
+
| --- | --- | --- |
|
|
152
|
+
| 4,302 bytes | 1,226 bytes (72% smaller) | 806 bytes (81% smaller) |
|
|
153
|
+
|
|
89
154
|
## Configuration
|
|
90
155
|
|
|
91
156
|
The CLI uses a `langgraph.json` configuration file with these key settings:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.42"
|
|
@@ -11,8 +11,9 @@ import time
|
|
|
11
11
|
from collections.abc import Callable, Mapping, Sequence
|
|
12
12
|
from contextlib import contextmanager
|
|
13
13
|
from dataclasses import asdict, dataclass, field
|
|
14
|
-
from datetime import datetime, timezone
|
|
14
|
+
from datetime import datetime, timedelta, timezone
|
|
15
15
|
from typing import Generic, Protocol, TypeVar
|
|
16
|
+
from uuid import UUID
|
|
16
17
|
|
|
17
18
|
import click
|
|
18
19
|
import click.exceptions
|
|
@@ -23,6 +24,7 @@ from langgraph_cli.analytics import log_command
|
|
|
23
24
|
from langgraph_cli.config import Config
|
|
24
25
|
from langgraph_cli.constants import DEFAULT_CONFIG
|
|
25
26
|
from langgraph_cli.dependency_tracking import find_tracked_packages
|
|
27
|
+
from langgraph_cli.deployment_metrics import compact_deployment_metrics
|
|
26
28
|
from langgraph_cli.docker import build_docker_image, can_build_locally
|
|
27
29
|
from langgraph_cli.exec import CommandRunner, Runner, subp_exec
|
|
28
30
|
from langgraph_cli.host_backend import (
|
|
@@ -2634,6 +2636,81 @@ def deploy_list(
|
|
|
2634
2636
|
# ---------------------------------------------------------------------------
|
|
2635
2637
|
|
|
2636
2638
|
|
|
2639
|
+
@OPT_HOST_API_KEY
|
|
2640
|
+
@OPT_HOST_URL
|
|
2641
|
+
@click.argument("deployment_id", type=click.UUID)
|
|
2642
|
+
@click.option(
|
|
2643
|
+
"--start-time",
|
|
2644
|
+
help="ISO8601 start time. Defaults to 15 minutes before --end-time.",
|
|
2645
|
+
)
|
|
2646
|
+
@click.option("--end-time", help="ISO8601 end time. Defaults to now.")
|
|
2647
|
+
@click.option(
|
|
2648
|
+
"--metrics",
|
|
2649
|
+
help=(
|
|
2650
|
+
"Comma-separated metric names. Defaults to all metrics. Supported names: "
|
|
2651
|
+
"memory_usage, cpu_usage, disk_usage, restart_count, replica_count, "
|
|
2652
|
+
"worker_count, lg_run_count, responses_per_second, "
|
|
2653
|
+
"error_responses_per_second, p95_latency, run_queue_wait_time. "
|
|
2654
|
+
"Availability depends on the deployment and platform."
|
|
2655
|
+
),
|
|
2656
|
+
)
|
|
2657
|
+
@click.option(
|
|
2658
|
+
"--summary", is_flag=True, help="Omit points and print per-series statistics only."
|
|
2659
|
+
)
|
|
2660
|
+
@click.option(
|
|
2661
|
+
"--raw", is_flag=True, help="Print the original host-backend chart schema."
|
|
2662
|
+
)
|
|
2663
|
+
@deploy.command(
|
|
2664
|
+
"metrics", help="[Beta] Fetch deployment monitoring time series as compact JSON."
|
|
2665
|
+
)
|
|
2666
|
+
def deploy_metrics(
|
|
2667
|
+
api_key: str | None,
|
|
2668
|
+
host_url: str | None,
|
|
2669
|
+
deployment_id: UUID,
|
|
2670
|
+
start_time: str | None,
|
|
2671
|
+
end_time: str | None,
|
|
2672
|
+
metrics: str | None,
|
|
2673
|
+
summary: bool,
|
|
2674
|
+
raw: bool,
|
|
2675
|
+
) -> None:
|
|
2676
|
+
if summary and raw:
|
|
2677
|
+
raise click.UsageError("--summary and --raw are mutually exclusive.")
|
|
2678
|
+
end_time = end_time or datetime.now(timezone.utc).isoformat()
|
|
2679
|
+
if start_time is None:
|
|
2680
|
+
try:
|
|
2681
|
+
end = datetime.fromisoformat(end_time.replace("Z", "+00:00"))
|
|
2682
|
+
except ValueError as exc:
|
|
2683
|
+
raise click.BadParameter(
|
|
2684
|
+
"Expected an ISO8601 timestamp.", param_hint="--end-time"
|
|
2685
|
+
) from exc
|
|
2686
|
+
end = end.replace(tzinfo=end.tzinfo or timezone.utc).astimezone(timezone.utc)
|
|
2687
|
+
start_time = (end - timedelta(minutes=15)).isoformat()
|
|
2688
|
+
params = {
|
|
2689
|
+
key: value
|
|
2690
|
+
for key, value in {
|
|
2691
|
+
"start_time": start_time,
|
|
2692
|
+
"end_time": end_time,
|
|
2693
|
+
"metrics": metrics,
|
|
2694
|
+
}.items()
|
|
2695
|
+
if value is not None
|
|
2696
|
+
}
|
|
2697
|
+
client = _create_host_backend_client(host_url, api_key, no_input=True)
|
|
2698
|
+
result = _call_host_backend_with_optional_tenant(
|
|
2699
|
+
client,
|
|
2700
|
+
lambda c: c.get_deployment_metrics(str(deployment_id), params),
|
|
2701
|
+
no_input=True,
|
|
2702
|
+
)
|
|
2703
|
+
if not raw:
|
|
2704
|
+
result = compact_deployment_metrics(
|
|
2705
|
+
result,
|
|
2706
|
+
str(deployment_id),
|
|
2707
|
+
start_time=start_time,
|
|
2708
|
+
end_time=end_time,
|
|
2709
|
+
summary=summary,
|
|
2710
|
+
)
|
|
2711
|
+
click.echo(json_mod.dumps(result, separators=(",", ":")))
|
|
2712
|
+
|
|
2713
|
+
|
|
2637
2714
|
@deploy.group(
|
|
2638
2715
|
"listeners",
|
|
2639
2716
|
cls=NestedHelpGroup,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Compact deployment chart responses for command-line consumers."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
from collections import Counter, defaultdict
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
|
+
from statistics import fmean
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _timestamp(value: str) -> datetime:
|
|
11
|
+
timestamp = datetime.fromisoformat(value.replace("Z", "+00:00"))
|
|
12
|
+
return timestamp.replace(tzinfo=timestamp.tzinfo or timezone.utc).astimezone(
|
|
13
|
+
timezone.utc
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _iso(value: datetime) -> str:
|
|
18
|
+
return value.isoformat().replace("+00:00", "Z")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _unit(title: str, metric: str | None) -> str | None:
|
|
22
|
+
if "%" in title:
|
|
23
|
+
return "percent"
|
|
24
|
+
if metric in {
|
|
25
|
+
"restart_count",
|
|
26
|
+
"replica_count",
|
|
27
|
+
"worker_count",
|
|
28
|
+
"lg_run_count",
|
|
29
|
+
"run_count",
|
|
30
|
+
}:
|
|
31
|
+
return "count"
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def compact_deployment_metrics(
|
|
36
|
+
response: dict[str, Any],
|
|
37
|
+
deployment_id: str,
|
|
38
|
+
*,
|
|
39
|
+
start_time: str,
|
|
40
|
+
end_time: str,
|
|
41
|
+
summary: bool = False,
|
|
42
|
+
) -> dict[str, Any]:
|
|
43
|
+
"""Reshape UI charts without mutating the response; step is in seconds."""
|
|
44
|
+
sections = {}
|
|
45
|
+
spacings: Counter[float] = Counter()
|
|
46
|
+
source_sections = list(response.get("sub_sections") or [])
|
|
47
|
+
if response.get("charts"):
|
|
48
|
+
source_sections.insert(0, response)
|
|
49
|
+
for section in source_sections:
|
|
50
|
+
charts = {}
|
|
51
|
+
for chart in section.get("charts") or []:
|
|
52
|
+
by_series = defaultdict(list)
|
|
53
|
+
for point in chart.get("data") or []:
|
|
54
|
+
timestamp = _timestamp(point["timestamp"])
|
|
55
|
+
value = point.get("value")
|
|
56
|
+
if value is not None and not math.isfinite(value):
|
|
57
|
+
value = None
|
|
58
|
+
by_series[point["series_id"]].append((timestamp, value))
|
|
59
|
+
series_output = {}
|
|
60
|
+
for series in chart.get("series") or []:
|
|
61
|
+
points = sorted(by_series[series["id"]], key=lambda point: point[0])
|
|
62
|
+
times = sorted({timestamp for timestamp, _ in points})
|
|
63
|
+
spacings.update(
|
|
64
|
+
(b - a).total_seconds()
|
|
65
|
+
for a, b in zip(times, times[1:], strict=False)
|
|
66
|
+
)
|
|
67
|
+
values = [value for _, value in points if value is not None]
|
|
68
|
+
metric = series.get("project_metric")
|
|
69
|
+
stats = {
|
|
70
|
+
"metric": metric,
|
|
71
|
+
"unit": _unit(chart["title"], metric),
|
|
72
|
+
"latest": round(values[-1], 3) if values else None,
|
|
73
|
+
"min": round(min(values), 3) if values else None,
|
|
74
|
+
"max": round(max(values), 3) if values else None,
|
|
75
|
+
"avg": round(fmean(values), 3) if values else None,
|
|
76
|
+
}
|
|
77
|
+
if not summary:
|
|
78
|
+
stats["points"] = [
|
|
79
|
+
[
|
|
80
|
+
_iso(timestamp),
|
|
81
|
+
round(value, 3) if value is not None else None,
|
|
82
|
+
]
|
|
83
|
+
for timestamp, value in points
|
|
84
|
+
]
|
|
85
|
+
series_output[series["name"]] = stats
|
|
86
|
+
charts[chart["title"]] = series_output or {"_empty": True}
|
|
87
|
+
sections[section["title"]] = charts or {"_empty": True}
|
|
88
|
+
step = min(spacings, key=lambda gap: (-spacings[gap], gap)) if spacings else None
|
|
89
|
+
return {
|
|
90
|
+
"deployment_id": deployment_id,
|
|
91
|
+
"start_time": start_time,
|
|
92
|
+
"end_time": end_time,
|
|
93
|
+
"step_seconds": int(step) if step is not None and step.is_integer() else step,
|
|
94
|
+
"sections": sections or {"_empty": True},
|
|
95
|
+
}
|
|
@@ -362,6 +362,13 @@ class HostBackendClient:
|
|
|
362
362
|
f"/v2/deployments/{deployment_id}/revisions/{revision_id}",
|
|
363
363
|
)
|
|
364
364
|
|
|
365
|
+
def get_deployment_metrics(
|
|
366
|
+
self, deployment_id: str, params: dict[str, Any]
|
|
367
|
+
) -> dict[str, Any]:
|
|
368
|
+
return self._request(
|
|
369
|
+
"GET", f"/v2/deployments/{deployment_id}/metrics", params=params
|
|
370
|
+
)
|
|
371
|
+
|
|
365
372
|
def get_build_logs(
|
|
366
373
|
self, project_id: str, revision_id: str, payload: dict[str, Any]
|
|
367
374
|
) -> Any:
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
import pytest
|
|
6
|
+
from click.testing import CliRunner
|
|
7
|
+
|
|
8
|
+
import langgraph_cli.deploy as deploy_module
|
|
9
|
+
from langgraph_cli.cli import cli
|
|
10
|
+
from langgraph_cli.deployment_metrics import compact_deployment_metrics
|
|
11
|
+
from langgraph_cli.host_backend import HostBackendClient
|
|
12
|
+
|
|
13
|
+
DEPLOYMENT_ID = "019a0000-0000-7000-8000-000000000001"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def invoke(monkeypatch, args, handler, input=None):
|
|
17
|
+
client = HostBackendClient(
|
|
18
|
+
"https://api.example.com",
|
|
19
|
+
"key",
|
|
20
|
+
tenant_id="workspace-id",
|
|
21
|
+
transport=httpx.MockTransport(handler),
|
|
22
|
+
)
|
|
23
|
+
monkeypatch.setattr(deploy_module, "HostBackendClient", lambda *a, **kw: client)
|
|
24
|
+
return CliRunner().invoke(
|
|
25
|
+
cli,
|
|
26
|
+
["deploy", *args, "--api-key", "key"],
|
|
27
|
+
input=input,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@pytest.mark.parametrize(
|
|
32
|
+
"bounds", [[], ["start_time"], ["end_time"], ["start_time", "end_time"]]
|
|
33
|
+
)
|
|
34
|
+
@pytest.mark.parametrize("mode", [None, "--summary", "--raw"])
|
|
35
|
+
def test_metrics(monkeypatch, bounds, mode, deployment_metrics_response):
|
|
36
|
+
charts = deployment_metrics_response
|
|
37
|
+
|
|
38
|
+
class FrozenDatetime(datetime):
|
|
39
|
+
@classmethod
|
|
40
|
+
def now(cls, tz=None):
|
|
41
|
+
return cls(2026, 10, 28, 23, 2, 33, tzinfo=timezone.utc)
|
|
42
|
+
|
|
43
|
+
monkeypatch.setattr(deploy_module, "datetime", FrozenDatetime)
|
|
44
|
+
explicit = {
|
|
45
|
+
"start_time": "2026-10-27T22:32:33Z",
|
|
46
|
+
"end_time": "2026-10-28T21:32:33Z",
|
|
47
|
+
}
|
|
48
|
+
options = {key: explicit[key] for key in bounds}
|
|
49
|
+
if bounds:
|
|
50
|
+
options["metrics"] = "cpu_usage,memory_usage"
|
|
51
|
+
params = {
|
|
52
|
+
"start_time": (
|
|
53
|
+
"2026-10-28T21:17:33+00:00"
|
|
54
|
+
if "end_time" in bounds
|
|
55
|
+
else "2026-10-28T22:47:33+00:00"
|
|
56
|
+
),
|
|
57
|
+
"end_time": "2026-10-28T23:02:33+00:00",
|
|
58
|
+
**options,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
def handler(request):
|
|
62
|
+
assert request.method == "GET"
|
|
63
|
+
assert request.url.path == f"/v2/deployments/{DEPLOYMENT_ID}/metrics"
|
|
64
|
+
assert dict(request.url.params) == params
|
|
65
|
+
assert request.headers["x-tenant-id"] == "workspace-id"
|
|
66
|
+
assert request.headers["x-api-key"] == "key"
|
|
67
|
+
return httpx.Response(200, json=charts)
|
|
68
|
+
|
|
69
|
+
args = ["metrics", DEPLOYMENT_ID]
|
|
70
|
+
for key, value in options.items():
|
|
71
|
+
args.extend([f"--{key.replace('_', '-')}", value])
|
|
72
|
+
if mode:
|
|
73
|
+
args.append(mode)
|
|
74
|
+
result = invoke(monkeypatch, args, handler)
|
|
75
|
+
assert result.exit_code == 0, result.output
|
|
76
|
+
expected = (
|
|
77
|
+
charts
|
|
78
|
+
if mode == "--raw"
|
|
79
|
+
else compact_deployment_metrics(
|
|
80
|
+
charts,
|
|
81
|
+
DEPLOYMENT_ID,
|
|
82
|
+
start_time=params.get("start_time"),
|
|
83
|
+
end_time=params.get("end_time"),
|
|
84
|
+
summary=mode == "--summary",
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
assert json.loads(result.output) == expected
|
|
88
|
+
if mode != "--raw":
|
|
89
|
+
assert expected["start_time"] == params["start_time"]
|
|
90
|
+
assert expected["end_time"] == params["end_time"]
|
|
91
|
+
assert result.output.strip() == json.dumps(expected, separators=(",", ":"))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@pytest.mark.parametrize(
|
|
95
|
+
"args",
|
|
96
|
+
[
|
|
97
|
+
["metrics", DEPLOYMENT_ID, "--step-seconds", "60"],
|
|
98
|
+
["metrics", "invalid-id"],
|
|
99
|
+
["metrics", DEPLOYMENT_ID, "--summary", "--raw"],
|
|
100
|
+
],
|
|
101
|
+
)
|
|
102
|
+
def test_invalid_options_do_not_send_requests(monkeypatch, args):
|
|
103
|
+
def handler(request):
|
|
104
|
+
pytest.fail("Invalid options must not send a request")
|
|
105
|
+
|
|
106
|
+
result = invoke(monkeypatch, args, handler)
|
|
107
|
+
assert result.exit_code == 2, result.output
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_end_only_with_timezone_offset(monkeypatch):
|
|
111
|
+
def handler(request):
|
|
112
|
+
assert request.url.params["end_time"] == "2026-10-28T01:05:00+02:00"
|
|
113
|
+
assert request.url.params["start_time"] == "2026-10-27T22:50:00+00:00"
|
|
114
|
+
return httpx.Response(200, json={"charts": [], "sub_sections": []})
|
|
115
|
+
|
|
116
|
+
result = invoke(
|
|
117
|
+
monkeypatch,
|
|
118
|
+
["metrics", DEPLOYMENT_ID, "--end-time", "2026-10-28T01:05:00+02:00"],
|
|
119
|
+
handler,
|
|
120
|
+
)
|
|
121
|
+
assert result.exit_code == 0, result.output
|
|
122
|
+
output = json.loads(result.output)
|
|
123
|
+
assert output["start_time"] == "2026-10-27T22:50:00+00:00"
|
|
124
|
+
assert output["end_time"] == "2026-10-28T01:05:00+02:00"
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_invalid_end_only_does_not_send_request(monkeypatch):
|
|
128
|
+
def handler(request):
|
|
129
|
+
pytest.fail("Invalid end time must not send a request")
|
|
130
|
+
|
|
131
|
+
result = invoke(
|
|
132
|
+
monkeypatch, ["metrics", DEPLOYMENT_ID, "--end-time", "not-a-date"], handler
|
|
133
|
+
)
|
|
134
|
+
assert result.exit_code == 2, result.output
|
|
135
|
+
assert "--end-time" in result.output
|
|
136
|
+
assert "ISO8601" in result.output
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_metrics_help_lists_supported_filters():
|
|
140
|
+
result = CliRunner().invoke(cli, ["deploy", "metrics", "--help"])
|
|
141
|
+
assert result.exit_code == 0, result.output
|
|
142
|
+
for metric in (
|
|
143
|
+
"memory_usage",
|
|
144
|
+
"cpu_usage",
|
|
145
|
+
"disk_usage",
|
|
146
|
+
"restart_count",
|
|
147
|
+
"replica_count",
|
|
148
|
+
"worker_count",
|
|
149
|
+
"lg_run_count",
|
|
150
|
+
"responses_per_second",
|
|
151
|
+
"error_responses_per_second",
|
|
152
|
+
"p95_latency",
|
|
153
|
+
"run_queue_wait_time",
|
|
154
|
+
):
|
|
155
|
+
assert metric in result.output
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@pytest.mark.parametrize("status", [403, 422, 429])
|
|
159
|
+
def test_backend_errors(monkeypatch, status):
|
|
160
|
+
def handler(request):
|
|
161
|
+
return httpx.Response(status, json={"detail": "Operation rejected"})
|
|
162
|
+
|
|
163
|
+
args = ["metrics", DEPLOYMENT_ID]
|
|
164
|
+
result = invoke(monkeypatch, args, handler)
|
|
165
|
+
assert result.exit_code == 1
|
|
166
|
+
assert "Operation rejected" in result.output
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import os
|
|
3
|
+
from pathlib import Path
|
|
2
4
|
from unittest.mock import patch
|
|
3
5
|
|
|
4
6
|
import pytest
|
|
5
7
|
|
|
6
8
|
|
|
9
|
+
@pytest.fixture
|
|
10
|
+
def deployment_metrics_response():
|
|
11
|
+
return json.loads(Path(__file__).with_name("deployment_metrics.json").read_text())
|
|
12
|
+
|
|
13
|
+
|
|
7
14
|
@pytest.fixture(autouse=True)
|
|
8
15
|
def disable_analytics_env() -> None:
|
|
9
16
|
"""Disable analytics for unit tests LANGGRAPH_CLI_NO_ANALYTICS."""
|