Runnable monitoring example#814
Conversation
Add a runnable Docker Compose monitoring stack with an OpenTelemetry Collector, Prometheus scrape and alert configuration, Grafana provisioning, a Fedify overview dashboard, and synthetic sample metrics. Wire the example into the workspace and example test list, add a dedicated validation task, and link the manual pages to the runnable setup. Fixes fedify-dev#745 Assisted-by: Codex:gpt-5.5
✅ Deploy Preview for fedify-json-schema ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@codex review |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesFedify monitoring example
Sequence Diagram(s)sequenceDiagram
participant FedifyApp as Fedify App
participant SampleMetrics as sample-metrics (Deno)
participant OtelCollector as OTel Collector :4317/:4318
participant Prometheus as Prometheus :9090
participant Grafana as Grafana :3000
rect rgba(100, 149, 237, 0.5)
Note over FedifyApp,OtelCollector: Metrics ingestion
FedifyApp->>OtelCollector: OTLP/gRPC or HTTP metrics
SampleMetrics->>OtelCollector: OTLP/HTTP synthetic metrics (every 1s)
end
rect rgba(144, 238, 144, 0.5)
Note over OtelCollector,Prometheus: Scrape pipeline
Prometheus->>OtelCollector: scrape :9464 (every 5s)
Prometheus->>Prometheus: evaluate fedify.rules
end
rect rgba(255, 165, 0, 0.5)
Note over Prometheus,Grafana: Visualization and provisioning
Grafana->>Prometheus: PromQL queries (fedify-overview dashboard)
Grafana->>Grafana: render panels (stat, timeseries)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds a new runnable monitoring example for Fedify, including configurations for OpenTelemetry Collector, Prometheus, Grafana, and a sample metrics generator. The review feedback identifies several critical issues with hallucinated, non-existent version numbers for Deno, Prometheus, Grafana, and the OTel Collector across the Docker Compose, datasource, validation, and dashboard files, which must be updated to valid stable versions to avoid deployment failures. Additionally, the reviewer suggests registering signal listeners in the validation script to ensure the Docker Compose stack is properly cleaned up when interrupted.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/monitoring/compose.yaml`:
- Around line 30-33: In the Grafana service configuration, the
GF_AUTH_ANONYMOUS_ORG_ROLE environment variable is currently set to "Admin",
which grants full administrative privileges to unauthenticated users. Change
this value from "Admin" to "Viewer" to reduce unnecessary exposure while
maintaining the anonymous access functionality needed for the example stack.
In `@examples/monitoring/README.md`:
- Around line 30-33: Convert the three inline autolinks for Grafana, Prometheus,
and Collector Prometheus endpoint from their current inline format
(http://localhost:3000/d/fedify-overview/fedify-overview,
http://localhost:9090/, and http://localhost:9464/metrics) to reference-style
links. Replace each inline autolink with a reference like [Grafana][1],
[Prometheus][2], and [Collector Prometheus endpoint][3], then add the
corresponding link definitions at the end of the section using the format [1]:
http://localhost:3000/d/fedify-overview/fedify-overview, etc. Apply the same
conversion pattern to the URLs mentioned in lines 203-207.
In `@examples/monitoring/validate.ts`:
- Around line 152-158: The `fetchJson` function lacks request-level timeouts on
its fetch call, which can cause the validation to hang indefinitely instead of
failing fast. Add a timeout mechanism using AbortController to bound each HTTP
request with a short timeout duration (e.g., a few seconds). Create an
AbortController, set a timeout that aborts the request if it exceeds the limit,
and pass the abort signal to the fetch options. Apply this same timeout pattern
to all fetch calls in the file, including the readiness probe check referenced
at the end of the comment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1fa5ef77-1bd1-40f6-8197-c3fd3fbea057
⛔ Files ignored due to path filters (1)
deno.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
deno.jsondocs/manual/monitoring.mddocs/manual/opentelemetry.mdexamples/README.mdexamples/monitoring/README.mdexamples/monitoring/compose.yamlexamples/monitoring/deno.jsonexamples/monitoring/grafana/dashboards/fedify-overview.jsonexamples/monitoring/grafana/provisioning/dashboards/dashboards.yamlexamples/monitoring/grafana/provisioning/datasources/datasources.yamlexamples/monitoring/otel-collector.yamlexamples/monitoring/prometheus-rules.test.yamlexamples/monitoring/prometheus-rules.yamlexamples/monitoring/prometheus.yamlexamples/monitoring/sample-metrics.tsexamples/monitoring/validate.tsexamples/test-examples/mod.tsmise.toml
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Reduce anonymous Grafana access to viewer permissions, use reference-style links in the monitoring README, and bound smoke-test HTTP probes with request timeouts. Also clean up the smoke Compose stack when validation is interrupted by SIGINT or SIGTERM. fedify-dev#814 (comment) fedify-dev#814 (comment) fedify-dev#814 (comment) fedify-dev#814 (comment) Assisted-by: Codex:gpt-5.5
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a local monitoring stack example for Fedify OpenTelemetry metrics, including a Docker Compose configuration, Grafana dashboards, Prometheus rules, a synthetic metrics generator, and a validation script. The code review identified critical issues where several non-existent versions of Docker images (OpenTelemetry Collector Contrib, Prometheus, Grafana, and Deno) were specified in the Compose file, datasource configuration, and validation script. Additionally, the documentation incorrectly references Deno 2.4 instead of Deno 2.0 or later for built-in OpenTelemetry support. Actionable suggestions were provided to update these to valid, stable versions to ensure the monitoring stack runs successfully.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/monitoring/README.md`:
- Around line 34-35: The documentation in README.md incorrectly states that
Grafana anonymous admin access is enabled, but the actual configuration in
compose.yaml sets GF_AUTH_ANONYMOUS_ORG_ROLE to Viewer. Update the text in the
warning statement (around line 34-35) to accurately reflect that anonymous
Viewer access (not admin access) is enabled for the local example, ensuring the
documentation matches the actual runtime configuration.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9e6a3a6b-71e2-4d4a-b618-1da2a6da0b3f
📒 Files selected for processing (3)
examples/monitoring/README.mdexamples/monitoring/compose.yamlexamples/monitoring/validate.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e510832c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The local Grafana stack now grants anonymous Viewer access, so the README should describe it that way. The Deno 2.4+ command examples also no longer need the obsolete OpenTelemetry unstable flag. fedify-dev#814 (comment) fedify-dev#814 (comment) fedify-dev#814 (comment) Assisted-by: Codex:gpt-5.5
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive local monitoring example stack for Fedify OpenTelemetry metrics, including a Docker Compose setup with Prometheus, Grafana, an OpenTelemetry Collector, and a synthetic metrics generator. It also adds Prometheus alerting rules, a pre-configured Grafana dashboard, and a validation script. The review feedback highlights several key improvements: guarding SIGTERM signal listeners to prevent runtime errors on Windows hosts, cancelling failed fetch response bodies to avoid resource leaks, and parallelizing Prometheus query evaluations during validation to improve performance.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Guard SIGTERM listeners so the monitoring scripts can run on Windows, release failed fetch response bodies, and validate independent Grafana queries in parallel. fedify-dev#814 (comment) fedify-dev#814 (comment) fedify-dev#814 (comment) fedify-dev#814 (comment) Assisted-by: Codex:gpt-5.5
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive, runnable monitoring example for Fedify. It packages an OpenTelemetry Collector, Prometheus, Grafana, alert rules, dashboard provisioning, and a synthetic metric generator into a Docker Compose stack. Additionally, the PR adds documentation links, integrates the example into the workspace, and implements a validation script with a corresponding test:monitoring task in mise.toml to perform static and smoke checks. No review comments were provided, so there is no further feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
examples/monitoring/validate.ts (1)
235-235: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider using the
SmokeSignaltype for consistency.The
cleanupAfterSignalfunction parameter uses an inline union type"SIGINT" | "SIGTERM"that duplicates theSmokeSignaltype defined at line 208. Reusing the type would improve maintainability.♻️ Suggested refactor
- const cleanupAfterSignal = (signal: "SIGINT" | "SIGTERM", code: number) => { + const cleanupAfterSignal = (signal: SmokeSignal, code: number) => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/monitoring/validate.ts` at line 235, The cleanupAfterSignal function parameter uses an inline union type "SIGINT" | "SIGTERM" which duplicates the SmokeSignal type already defined in the file. Replace the inline union type annotation for the signal parameter with the SmokeSignal type to improve consistency and maintainability across the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@examples/monitoring/validate.ts`:
- Line 235: The cleanupAfterSignal function parameter uses an inline union type
"SIGINT" | "SIGTERM" which duplicates the SmokeSignal type already defined in
the file. Replace the inline union type annotation for the signal parameter with
the SmokeSignal type to improve consistency and maintainability across the
codebase.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 53edca76-59ee-4b94-82da-083ca3041231
📒 Files selected for processing (2)
examples/monitoring/sample-metrics.tsexamples/monitoring/validate.ts
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Use the existing SmokeSignal alias for the smoke cleanup helper instead of repeating the signal union inline. fedify-dev#814 Assisted-by: Codex:gpt-5.5
Closes #745.
This adds a local monitoring example under examples/monitoring/. The example gives operators a stack they can run before connecting a real Fedify application: an OpenTelemetry Collector receives OTLP metrics, Prometheus scrapes the Collector and loads starter alert rules, Grafana provisions a Prometheus data source and the Fedify overview dashboard, and a small Deno process emits synthetic Fedify-shaped metrics so the dashboard has data immediately.
The Compose stack binds host ports to
127.0.0.1, since Grafana anonymous viewer access is enabled for this local example.What changed
mise run test:monitoringto check the Deno scripts, Compose config, Prometheus config/rules/rule tests, and Collector config.How to try it
From the repository root:
Then open:
examples/monitoring/README.md explains how to point a Deno, Node.js, Bun, or custom OpenTelemetry setup at the Collector.
Validation
mise run checkmise run test:monitoringAI usage
This PR was prepared with assistance from Codex.