mirror of
https://github.com/agent-substrate/substrate.git
synced 2026-11-11 10:23:17 +08:00
Fixes #564 (Part 1) - [x] Tests pass - [x] Appropriate changes to documentation are included in the PR ## Description This PR implements the first part of #564 by extending metric `atenet.router.route.duration` with singleflight activation state (`ate.router.resume`) and outcome status labels (`ate.router.outcome`). All telemetry attribute keys and label value sets are centralized in `internal/ateattr` to ensure consistency across components. ## Key Changes: * Added `resumed` boolean to `ResumeActorResponse` in `ateapi.proto` indicating whether a cold activation workflow occurred (`!state.WasRunning`). * Updated `workflow_resume_test.go` to assert `resumed == true` on cold activations and `resumed == false` for already-running actors. * Extended `classifyOutcome(err)` in Envoy `ext_proc` to classify errors into metric labels: `ok`, `cancelled`, `timeout`, `no_capacity`, `lock_conflict`, `not_found`, `unavailable`, `rate_limited`, and `resume_error`. * Added explicit handling for `codes.Unavailable` (`"unavailable"`) and `codes.ResourceExhausted` / `StatusCode_TooManyRequests` (`"rate_limited"`). * Consolidated metric label names on `atenet.router.route.duration` using standard keys from `internal/ateattr`: * `ate.template.namespace` (`TemplateNamespaceKey`) * `ate.template.name` (`TemplateNameKey`) * `ate.router.outcome` (`RouterOutcomeKey`) * `ate.router.resume` (`RouterResumeKey`) * Updated `manifests/ate-install/kind/kustomization.yaml` to export `atenet-router` OTLP metrics to `opentelemetry-collector`. ## Testing * `go test -buildvcs=false ./cmd/ateapi/internal/controlapi/...` * `go test -buildvcs=false ./cmd/atenet/internal/router/...` * `make test` ## E2E Test * `./hack/create-kind-cluster.sh` * `./hack/install-ate-kind.sh --deploy-ate-system --deploy-demo-counter` * `./hack/run-e2e.sh ./internal/e2e/suites/metrics/...`