Skip to content

chore(observability): land PR #84 content on main (cherry-pick recovery) - #103

Merged
0xfandom merged 6 commits into
mainfrom
recovery/pr84-to-main
Apr 21, 2026
Merged

chore(observability): land PR #84 content on main (cherry-pick recovery)#103
0xfandom merged 6 commits into
mainfrom
recovery/pr84-to-main

Conversation

@0xfandom

Copy link
Copy Markdown
Collaborator

Summary

Recovery PR for PR #84. PR #84 was marked merged but landed in feat/observability-pr1 (its stacked base) instead of main because that parent branch wasn't auto-deleted after PR #83 merged. This PR brings PR #84's Loki + Promtail + structured-log content to main via clean cherry-picks onto current main.

Files Changed

Area Files
Loki + Promtail services deploy/docker/loki/loki-config.yml, deploy/docker/promtail/promtail-config.yml, deploy/docker/docker-compose.yml (loki + promtail services + healthcheck + service_healthy dep + ingestion/stream caps)
Grafana datasource deploy/docker/grafana/provisioning/datasources/loki.yml (pinned uid: loki)
Rust JSON logs crates/grpc-server/src/main.rs (LOG_FORMAT=json gate + .flatten_event(true)), Cargo.toml (tracing-subscriber json feature)
Go slog migration cmd/executor/main.go, bundle.go, nonce.go, gas_oracle.go, submitter.go, cmd/monitor/alerter.go, dashboard.go, metrics.go, cmd/pooldiscovery/main.go, internal/risk/state.go, manager.go
Dashboard deploy/docker/grafana/dashboards/overview.json (Recent errors panel)
Env .env.example (documents LOG_FORMAT)

Acceptance Criteria

Notes

Pablosinyores and others added 6 commits April 21, 2026 12:23
Self-hosted log aggregation stack wired into the existing docker-compose
so container stdout/stderr is scraped by promtail and pushed to loki with
7 day retention. Labels attached per stream: service (from the compose
service name) and container_name. Rust service gets LOG_FORMAT=json set
on the container so its tracing-subscriber emits structured JSON.
Mirror the prometheus datasource file so grafana auto-provisions loki
alongside it, pointing at the in-network loki service. Pinned uid so
dashboards can reference it stably.
Enable the tracing-subscriber json feature and branch on LOG_FORMAT at
startup: LOG_FORMAT=json installs a structured json layer (current span
included, span list omitted to keep lines compact) while any other
value keeps the existing pretty text output. Production docker runs
with LOG_FORMAT=json so promtail can ship structured records to loki;
local cargo run stays human readable.
Install a json slog handler as the default logger in each binary entry
point (executor, monitor, pooldiscovery) and convert log.Printf call
sites at the module boundaries to slog.Info/Warn/Error with structured
key/value fields. Boundary scope only: cmd/executor/main.go,
cmd/monitor/*, cmd/pooldiscovery/main.go, and internal/risk/manager.go.
Deeper utility loggers in gas_oracle, nonce, submitter, bundle, and
state files keep their stdlib log for now and can be migrated later.

Fatal exits are converted to slog.Error + os.Exit(1) since slog has no
Fatal equivalent. Context-aware InfoContext/ErrorContext is used on
the arb processing hot path so future tracing work can attach span ids.
Append a loki-backed logs panel below the existing 7 panels. Filters to
aether-* services and level=(error|warn) after parsing the structured
log lines, sorted newest first, with details expanded on click. The
query works against both the rust tracing json layer and the go slog
json handler because both emit a level field.
- migrate bundle/nonce/gas_oracle/submitter/state.go to slog so loki errors-panel stops silently dropping log.Printf / log.Fatalf
- flatten_event(true) on rust json tracing so fields land at root, not under fields.*
- loki healthcheck + promtail service_healthy dep to avoid cold-boot 503s
- loki limits: max_streams_per_user 500, ingestion_rate 8MB, burst 16MB
@0xfandom
0xfandom merged commit 6cb2f2e into main Apr 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants