feat: metrics endpoint, RFC 8058 unsubscribe, CI workflow, and Biome linting#204
Open
Darkdante9 wants to merge 1 commit into
Open
feat: metrics endpoint, RFC 8058 unsubscribe, CI workflow, and Biome linting#204Darkdante9 wants to merge 1 commit into
Darkdante9 wants to merge 1 commit into
Conversation
…linting Dgetsylver#65 — Prometheus /metrics endpoint and Grafana dashboard - Add GET /metrics to the Cloudflare Worker that emits subscriber-level counters in Prometheus text format (v0.0.4): turbolong_subscribers_total turbolong_subscribers_by_pool{pool="…"} turbolong_subscribers_by_leverage{leverage="…x"} turbolong_subscribers_by_asset{asset="…"} - Auth: set METRICS_TOKEN secret for Bearer-token gating; unset = public. - Rate-limiting: delegate to a Cloudflare WAF rule (no Worker state needed). - Add dashboards/turbolong-overview.json — importable Grafana dashboard with stat, bar-chart, and table panels wired to the above metrics. Dgetsylver#67 — RFC 8058 one-click unsubscribe - sendEmail() now accepts an optional extraHeaders map forwarded to the Resend API's headers field. - sendApyAlert() attaches List-Unsubscribe and List-Unsubscribe-Post headers on every alert email so Gmail, Apple Mail, and other major clients render a native unsubscribe button. - /unsubscribe now handles POST (RFC 8058 one-click flow): silently deletes the subscription and returns HTTP 200 with no body — no confirmation page required. Dgetsylver#68 — GitHub Actions CI - Add .github/workflows/ci.yml with four jobs triggered on push to main and every pull request: frontend — npm ci, tsc --noEmit, vite build, vitest run rust — cargo check, cargo clippy -D warnings, cargo test worker — npm ci, tsc --noEmit (alerts Worker) lint — biome lint + biome format check across frontend/src and alerts/src Dgetsylver#69 — Biome formatter and linter - Add biome.json at the repo root: 2-space indent, double quotes, semicolons, 100-char line width, recommended lint rules with noExplicitAny disabled (idiomatic for Worker / RPC glue code). - Add @biomejs/biome ^1.9.4 to devDependencies in frontend/package.json and alerts/package.json. - Add lint, format, and format:check npm scripts to both packages. Closes Dgetsylver#65 Closes Dgetsylver#67 Closes Dgetsylver#68 Closes Dgetsylver#69
|
@Darkdante9 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /metrics(Prometheus text format) to the Worker exposing subscriber counters per pool, leverage bracket, and asset. Bearer-token auth viaMETRICS_TOKENsecret (optional). Grafana dashboard committed asdashboards/turbolong-overview.json(importable JSON).List-UnsubscribeandList-Unsubscribe-Post: List-Unsubscribe=One-Clickheaders to every alert email.POST /unsubscribe?token=…now handles one-click POSTs silently (HTTP 200, no body) per RFC 8058..github/workflows/ci.ymlwith four jobs on PR + push to main:frontend(tsc + vite build + vitest),rust(check + clippy + test),worker(tsc),lint(biome lint + format check).biome.jsonat repo root (2-space indent, double quotes, semicolons, 100-char line width, recommended rules). Add@biomejs/biomedevDependency andlint/format/format:checkscripts tofrontend/package.jsonandalerts/package.json.Files changed
alerts/src/index.tsalerts/src/email.tsdashboards/turbolong-overview.json.github/workflows/ci.ymlbiome.jsonfrontend/package.jsonalerts/package.jsonTest plan
curl /metrics— verify Prometheus text format response/metricswith and withoutMETRICS_TOKENsetdashboards/turbolong-overview.jsoninto a Grafana instance and confirm panels renderList-UnsubscribeandList-Unsubscribe-Post/unsubscribe?token=<valid>and confirm HTTP 200 with empty bodynpm run lintandnpm run format:checklocally infrontend/andalerts/Closes #65
Closes #67
Closes #68
Closes #69