Skip to content

Commit bb80829

Browse files
Morlejclaude
andcommitted
fix(dsql): document CloudWatch MCP setup and fix Workflow 12 gaps
Workflow 12 (System Diagnostics) required the CloudWatch MCP server but gave no way to enable it, and agents that hit unavailable PromQL tools had no recovery guidance. Address the observed failure modes: - Add a CloudWatch MCP Server section to mcp/mcp-setup.md: enabling the shipped-disabled server, AWS_REGION/AWS_PROFILE config, the PromQL-enabled region limitation, and the session restart needed for its tools to register (a mid-session enable shows "Connected" but exposes no callable tools until restart). - Add AWS_REGION/AWS_PROFILE placeholders to the disabled cloudwatch entry in .mcp.json so users see what to fill in. - workflow.md: add an explicit "If the PromQL tools are unavailable" callout in Prerequisites (enable + restart, no fabrication/CLI fallback) and a matching Error Handling row, so a blocked agent surfaces the fix rather than only reporting missing data. - Document the discovery-window gotcha: get_promql_label_values defaults to a window ending "now" and returns empty for older data; pass explicit start/end. An empty result means "no data in window," not "no such cluster." - Fix "6 diagnostic workflows/sub-workflows" -> "5 diagnostic phases" in SKILL.md (both the reference table and Workflow 12 section). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent afe0564 commit bb80829

4 files changed

Lines changed: 68 additions & 15 deletions

File tree

plugins/databases-on-aws/.mcp.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
],
2222
"disabled": true,
2323
"env": {
24-
"FASTMCP_LOG_LEVEL": "ERROR"
24+
"FASTMCP_LOG_LEVEL": "ERROR",
25+
"AWS_REGION": "[your dsql cluster region, e.g. us-east-1 — must be a PromQL-enabled region]",
26+
"AWS_PROFILE": "[your aws profile name, e.g. default]"
2527
}
2628
}
2729
}

plugins/databases-on-aws/skills/dsql/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Load these files as needed for detailed guidance:
7979

8080
| Reference | When to Load | Contains |
8181
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------- |
82-
| [system-diagnostics/workflow.md](references/system-diagnostics/workflow.md) | MUST load at Workflow 12 entry — cluster performance diagnostics | Prerequisites, 6 diagnostic workflows, temporal comparison, handoff |
82+
| [system-diagnostics/workflow.md](references/system-diagnostics/workflow.md) | MUST load at Workflow 12 entry — cluster performance diagnostics | Prerequisites, 5 diagnostic phases, temporal comparison, handoff |
8383
| [system-diagnostics/wait-events.md](references/system-diagnostics/wait-events.md) | ALWAYS load when interpreting AAS results | Canonical DSQL wait event descriptions and investigation guidance |
8484
| [system-diagnostics/promql-patterns.md](references/system-diagnostics/promql-patterns.md) | Load when constructing PromQL queries | Reusable query templates for AAS breakdown, top-SQL, temporal compare |
8585

@@ -262,9 +262,9 @@ Load [orm-guides/overview.md](references/orm-guides/overview.md) for adapter nam
262262

263263
Diagnose cluster performance by querying `db.active_sessions.avg` via PromQL. Detects temporal anomalies in wait event distribution, identifies regressed queries, and routes to Workflow 9 for per-query investigation.
264264

265-
**Requires:** CloudWatch MCP server (`awslabs.cloudwatch-mcp-server`) configured with PromQL access in the same region as the cluster.
265+
**Requires:** CloudWatch MCP server (`awslabs.cloudwatch-mcp-server`) enabled and configured with PromQL access in the same region as the cluster — see [mcp/mcp-setup.md](mcp/mcp-setup.md#cloudwatch-mcp-server-system-diagnostics--workflow-12) for enabling it, region requirements, and the session restart needed for its tools to register.
266266

267-
MUST load [system-diagnostics/workflow.md](references/system-diagnostics/workflow.md) at entry — it defines prerequisites, 6 diagnostic sub-workflows, temporal baselines, and the routing to Workflow 9 for identified queries.
267+
MUST load [system-diagnostics/workflow.md](references/system-diagnostics/workflow.md) at entry — it defines prerequisites, 5 diagnostic phases, temporal baselines, and the routing to Workflow 9 for identified queries.
268268

269269
## Error Scenarios
270270

plugins/databases-on-aws/skills/dsql/mcp/mcp-setup.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,54 @@ has custom AWS configurations or would like to allow/disallow the MCP server mut
106106
to be for the MCP server. Always ask the user if writes
107107
should be allowed.
108108

109+
## CloudWatch MCP Server (System Diagnostics — Workflow 12)
110+
111+
Workflow 12 (System Diagnostics) reads Aurora DSQL Active Average Sessions (AAS) telemetry
112+
through the CloudWatch MCP server's PromQL tools. This is a **separate server** from
113+
`aurora-dsql` — it reads CloudWatch metrics, not the database — so it has its own entry in
114+
`.mcp.json`. The plugin ships it disabled because it needs region and credential details the
115+
plugin can't know in advance.
116+
117+
The plugin's `.mcp.json` pre-configures it as:
118+
119+
```json
120+
{
121+
"mcpServers": {
122+
"cloudwatch": {
123+
"command": "uvx",
124+
"args": ["awslabs.cloudwatch-mcp-server@latest"],
125+
"env": {
126+
"FASTMCP_LOG_LEVEL": "ERROR",
127+
"AWS_REGION": "[your dsql cluster region, e.g. us-east-1 — must be a PromQL-enabled region]",
128+
"AWS_PROFILE": "[your aws profile name, e.g. default]"
129+
},
130+
"disabled": true
131+
}
132+
}
133+
}
134+
```
135+
136+
To enable it:
137+
138+
1. Set `AWS_REGION` to the cluster's region and `AWS_PROFILE` to a profile with CloudWatch
139+
read permissions (`cloudwatch:GetMetricData`, and the CloudWatch PromQL / `aps` query
140+
permissions). The server uses the standard AWS credential chain, so `--profile` on the
141+
command line or `AWS_PROFILE` in `env` both work.
142+
2. Set `"disabled": false`.
143+
144+
**Region matters.** The server must run in the **same region as the DSQL cluster**, and
145+
CloudWatch PromQL is only available in a subset of regions — at the time of writing:
146+
`us-east-1`, `us-west-2`, `eu-west-1`, `ap-southeast-1`, `ap-southeast-2`. If the cluster is
147+
in another region, PromQL-based diagnostics are not available there; verify the current list
148+
in the CloudWatch documentation.
149+
150+
**Restart after enabling.** MCP tools are registered when the session starts. If you enable
151+
the server (or fix its config) mid-session, its tools (`execute_promql_range_query`,
152+
`get_promql_label_values`, `get_metric_data`, …) will **not** become callable until you
153+
restart the coding assistant — even though `claude mcp list` may already show it as
154+
"Connected". A server that shows Connected but whose tools return "No such tool available" is
155+
the classic symptom of this: restart the session to pick them up.
156+
109157
## Coding Assistant - Custom Instructions
110158

111159
Before proceeding, identify which coding assistant you are adding the MCP server to and

plugins/databases-on-aws/skills/dsql/references/system-diagnostics/workflow.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ Diagnose Aurora DSQL cluster performance by querying Active Average Sessions (AA
3030
**MUST** have before starting:
3131

3232
1. A specific `cluster_id` to investigate — never proceed without one. Ask the user if not provided.
33-
2. The CloudWatch MCP server (`awslabs.cloudwatch-mcp-server`) configured with PromQL access in the **same region** as the DSQL cluster
33+
2. The CloudWatch MCP server (`awslabs.cloudwatch-mcp-server`) enabled and configured with PromQL access in the **same region** as the DSQL cluster. See [mcp-setup.md](../../mcp/mcp-setup.md#cloudwatch-mcp-server-system-diagnostics--workflow-12) for how to enable it, the region requirement, PromQL-enabled regions, and the required session restart. If its PromQL tools are unavailable, resolve that before starting rather than working around it — see Error Handling below.
3434
3. The `aurora-dsql` MCP server configured for the target cluster (for per-query investigation via EXPLAIN)
3535

36+
**If the PromQL tools are unavailable** (e.g. `execute_promql_range_query` / `get_promql_label_values` are missing, or a call returns "No such tool available"): the diagnostic cannot run, and there is no substitute — AAS is only readable through these tools, so do not fall back to the AWS CLI, standard CloudWatch metrics, or fabricated numbers. The usual cause is that the CloudWatch server is disabled, misconfigured, or was enabled after this session started (its tools only register at session start). **Tell the user to enable/fix it per [mcp-setup.md](../../mcp/mcp-setup.md#cloudwatch-mcp-server-system-diagnostics--workflow-12) and then restart the session**, since a mid-session enable will show as "Connected" yet still expose no callable tools until restart. Report this as the blocker and the fix, rather than reporting only that data is missing.
37+
3638
---
3739

3840
## Reference Files
@@ -81,7 +83,7 @@ The primary metric is `db.active_sessions.avg` — the average number of session
8183
**Steps:**
8284

8385
1. Confirm you have a specific `cluster_id` — do not proceed without one
84-
2. Verify the cluster exists by calling `get_promql_label_values` with a match filter (see [promql-patterns.md](promql-patterns.md))
86+
2. Verify the cluster exists by calling `get_promql_label_values` with a match filter **and an explicit `start`/`end` window covering the period you intend to analyze** (see [promql-patterns.md](promql-patterns.md)). Label-value and series lookups default to a window ending "now"; if the cluster's most recent data is older than that default (for example, a lightly-used or paused cluster), the call returns an empty list even though the cluster exists. An empty result here means "no data in that window," not "no such cluster" — widen or shift the window before concluding the cluster is missing.
8587
3. Query AAS by `db.wait.event` for the **current hour** in 10-minute chunks (step=60s)
8688
4. Query AAS by `db.wait.event` for the **same hour yesterday** (baseline 1)
8789
5. Query AAS by `db.wait.event` for the **same hour last week** (baseline 2)
@@ -93,7 +95,7 @@ The primary metric is `db.active_sessions.avg` — the average number of session
9395

9496
- **MUST** filter by cluster using `"@resource.aws.auroradsql.cluster_id"` in all queries
9597
- **MUST** quote label names that contain `.` or `@` in PromQL selectors
96-
- **MUST** use the `match` parameter with `get_promql_label_values` — calls without match return empty
98+
- **MUST** use the `match` parameter with `get_promql_label_values` — calls without match return empty. When the data you care about is not recent, **also** pass an explicit `start`/`end`, since these lookups default to a window ending "now" and will otherwise miss older data
9799
- **MUST** compare against temporal baselines — do NOT report absolute AAS values as inherently problematic
98100
- A >30% change in a wait event's share of total AAS warrants flagging
99101

@@ -282,11 +284,12 @@ execute_promql_range_query(
282284

283285
## Error Handling
284286

285-
| Situation | Action |
286-
| ---------------------- | ---------------------------------------------------------------------- |
287-
| No cluster_id provided | Ask the user — never proceed without a specific cluster |
288-
| No series found | Verify cluster ID with `get_promql_label_values`. Check region. |
289-
| Empty result (no data) | Cluster is idle for that period. Widen time window. |
290-
| `db.query.id` missing | Not all queries emit it. Filter by `db.query.normalized_text` instead. |
291-
| PromQL timeout | Reduce cardinality — fewer labels or shorter time range. |
292-
| Range > 7 days | Split into multiple 7-day range queries. |
287+
| Situation | Action |
288+
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
289+
| No cluster_id provided | Ask the user — never proceed without a specific cluster |
290+
| PromQL tools not callable (e.g. "No such tool available") | The CloudWatch server is not enabled, is misconfigured, or was enabled after the session started. Enable/fix it per [mcp-setup.md](../../mcp/mcp-setup.md#cloudwatch-mcp-server-system-diagnostics--workflow-12), then **restart the session** — tools are registered at startup. Do not fall back to guessing or to unrelated tools. |
291+
| No series / empty label values | Confirm the `match` selector, then widen or shift the `start`/`end` window — these lookups default to "now" and miss older data. Only after that, suspect a wrong cluster ID or region. |
292+
| Empty result (no data) | Cluster is idle for that period. Widen time window. |
293+
| `db.query.id` missing | Not all queries emit it. Filter by `db.query.normalized_text` instead. |
294+
| PromQL timeout | Reduce cardinality — fewer labels or shorter time range. |
295+
| Range > 7 days | Split into multiple 7-day range queries. |

0 commit comments

Comments
 (0)