Files
Kazuki Yamada 54c6a3d238 fix(website): Address claude third-pass review on siteverify metric
Six items from claude's incremental review (`12:48:43Z`):

- monitoring/dashboard.json: Group the outcomes widget by both
  `metric.label.outcome` and `metric.label.reason`. Previously all
  failures collapsed into a single `turnstile_failed` series, which
  contradicted the README claim that the `reason` label drives the
  breakdown.
- monitoring/metrics/*.yaml: Narrow the metric filter to
  `jsonPayload.event=("turnstile_siteverify" OR "pack_completed")`.
  Without this anchor, any future code path attaching
  `siteverifyDurationMs` to an unrelated log silently joins the
  distribution and creates new metric label values.
- usePackRequest.ts: Mirror `progressMessage.value = null` alongside
  the `progressStage.value = null` clear on token-acquisition aborted /
  error branches. Prevents a future edit setting a verifying message
  from leaking prior-run state.
- turnstile.test.ts: Add a focused `describe` block with five tests
  asserting `siteverifyDurationMs` is attached to every post-siteverify
  log (one success path + four reject branches). The metric YAML
  filters on field presence, so a refactor that drops the field on any
  branch would silently break the metric without other tests failing.
  Uses the existing `vi.spyOn(logger, ...)` pattern; no clock injection
  needed.
- monitoring/README.md: Note that the metric filter pins
  `service_name="repomix-server-us"`, so future regions (`-eu`,
  `-asia`) silently drop out until the filter is broadened or
  per-region counterparts applied.
- monitoring/README.md: Add a `gcloud logging metrics describe` snippet
  for verifying a YAML edit was actually applied (gcloud update is
  silent on no-op vs effective change).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 21:59:53 +09:00

701 lines
23 KiB
JSON

{
"displayName": "Repomix Server Ops (repomix-server-us)",
"mosaicLayout": {
"columns": 12,
"tiles": [
{
"xPos": 0,
"yPos": 0,
"width": 6,
"height": 4,
"widget": {
"title": "Request rate (by response class)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/request_count\" resource.type=\"cloud_run_revision\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_RATE",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.response_code_class"]
}
}
},
"plotType": "LINE",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "req/s", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 0,
"width": 6,
"height": 4,
"widget": {
"title": "Instance count (max=10)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/container/instance_count\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_MEAN",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.state"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1"
}
],
"thresholds": [{ "value": 10, "label": "max_instances" }],
"yAxis": { "label": "instances", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 4,
"width": 6,
"height": 4,
"widget": {
"title": "Memory utilization (P50 / P95)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/container/memory/utilizations\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_50",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P50",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/container/memory/utilizations\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_95",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P95",
"targetAxis": "Y1"
}
],
"thresholds": [{ "value": 0.85, "label": "warn" }],
"yAxis": { "label": "utilization", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 4,
"width": 6,
"height": 4,
"widget": {
"title": "OOM terminations (5 min buckets)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/oom_terminations\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM"
}
}
},
"plotType": "STACKED_BAR",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 8,
"width": 6,
"height": 4,
"widget": {
"title": "Container killed — OOM (5 min buckets)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/container_killed\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM"
}
}
},
"plotType": "STACKED_BAR",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 12,
"width": 6,
"height": 4,
"widget": {
"title": "Pack outcome (stacked by outcome)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_requests\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.outcome"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 12,
"width": 6,
"height": 4,
"widget": {
"title": "Cache hit ratio (success only)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_requests\" metric.label.outcome=\"success\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.cached"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1",
"legendTemplate": "cached=${metric.labels.cached}"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 16,
"width": 6,
"height": 4,
"widget": {
"title": "Input type (URL vs file upload)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_requests\" metric.label.outcome=\"success\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.input_type"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 16,
"width": 6,
"height": 4,
"widget": {
"title": "Country TOP (stacked)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_requests_by_country\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.country"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 8,
"width": 6,
"height": 4,
"widget": {
"title": "Request latency P50 / P95 / P99",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/request_latencies\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_50",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P50",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/request_latencies\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_95",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P95",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"run.googleapis.com/request_latencies\" resource.labels.service_name=\"repomix-server-us\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_99",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P99",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "ms", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 20,
"width": 6,
"height": 4,
"widget": {
"title": "Pack output tokens (P50 / P95 / P99)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_output_tokens\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_PERCENTILE_50",
"crossSeriesReducer": "REDUCE_MEAN"
}
}
},
"plotType": "LINE",
"legendTemplate": "P50",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_output_tokens\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_PERCENTILE_95",
"crossSeriesReducer": "REDUCE_MEAN"
}
}
},
"plotType": "LINE",
"legendTemplate": "P95",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_output_tokens\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_PERCENTILE_99",
"crossSeriesReducer": "REDUCE_MEAN"
}
}
},
"plotType": "LINE",
"legendTemplate": "P99",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "tokens", "scale": "LOG10" }
}
}
},
{
"xPos": 6,
"yPos": 20,
"width": 6,
"height": 4,
"widget": {
"title": "Pack output files (P50 / P95 / P99)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_output_files\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_PERCENTILE_50",
"crossSeriesReducer": "REDUCE_MEAN"
}
}
},
"plotType": "LINE",
"legendTemplate": "P50",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_output_files\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_PERCENTILE_95",
"crossSeriesReducer": "REDUCE_MEAN"
}
}
},
"plotType": "LINE",
"legendTemplate": "P95",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_output_files\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_PERCENTILE_99",
"crossSeriesReducer": "REDUCE_MEAN"
}
}
},
"plotType": "LINE",
"legendTemplate": "P99",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "files", "scale": "LOG10" }
}
}
},
{
"xPos": 0,
"yPos": 24,
"width": 3,
"height": 4,
"widget": {
"title": "Option usage — compress",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_options_usage\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.compress"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1",
"legendTemplate": "compress=${metric.labels.compress}"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 3,
"yPos": 24,
"width": 3,
"height": 4,
"widget": {
"title": "Option usage — removeComments",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_options_usage\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.remove_comments"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1",
"legendTemplate": "removeComments=${metric.labels.remove_comments}"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 24,
"width": 3,
"height": 4,
"widget": {
"title": "Option usage — outputParsable",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_options_usage\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.output_parsable"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1",
"legendTemplate": "outputParsable=${metric.labels.output_parsable}"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 9,
"yPos": 24,
"width": 3,
"height": 4,
"widget": {
"title": "Option usage — include patterns",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_options_usage\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.has_include_patterns"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1",
"legendTemplate": "hasIncludePatterns=${metric.labels.has_include_patterns}"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 28,
"width": 12,
"height": 4,
"widget": {
"title": "Validation rejections (by reason)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/pack_validation_errors\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.reject_reason"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
},
{
"xPos": 0,
"yPos": 32,
"width": 6,
"height": 4,
"widget": {
"title": "Turnstile siteverify latency P50 / P95 / P99",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/turnstile_siteverify_duration\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_50",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P50",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/turnstile_siteverify_duration\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_95",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P95",
"targetAxis": "Y1"
},
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/turnstile_siteverify_duration\"",
"aggregation": {
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_PERCENTILE_99",
"crossSeriesReducer": "REDUCE_MAX"
}
}
},
"plotType": "LINE",
"legendTemplate": "P99",
"targetAxis": "Y1"
}
],
"thresholds": [{ "value": 1000, "label": "1s" }],
"yAxis": { "label": "ms", "scale": "LINEAR" }
}
}
},
{
"xPos": 6,
"yPos": 32,
"width": 6,
"height": 4,
"widget": {
"title": "Turnstile siteverify outcomes (by outcome / reason)",
"xyChart": {
"dataSets": [
{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/turnstile_siteverify_outcomes\"",
"aggregation": {
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_DELTA",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": ["metric.label.outcome", "metric.label.reason"]
}
}
},
"plotType": "STACKED_AREA",
"targetAxis": "Y1"
}
],
"yAxis": { "label": "count / 5min", "scale": "LINEAR" }
}
}
}
]
}
}