Skip to content

🔥 feat: Add Uptime Middleware#2038

Open
gofurry wants to merge 47 commits into
gofiber:mainfrom
gofurry:pr/uptime-middleware
Open

🔥 feat: Add Uptime Middleware#2038
gofurry wants to merge 47 commits into
gofiber:mainfrom
gofurry:pr/uptime-middleware

Conversation

@gofurry

@gofurry gofurry commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new uptime middleware for Fiber v3.

The middleware records in-process heartbeat history, stores uptime state through github.com/gofiber/storage/redis/v3, and serves a built-in status dashboard with a JSON status API.

QQ20260626-182538

Summary by CodeRabbit

  • New Features
    • Added Fiber v3 uptime middleware that records periodic heartbeats, performs daily rollups and retention cleanup, and serves a /api/status JSON endpoint plus an auto-refreshing interactive dashboard with live/stale/error indicators.
  • Documentation
    • Added comprehensive uptime package documentation and updated the middleware listings in the main and v3 READMEs.
  • Tests
    • Added extensive automated tests covering configuration validation, handler behavior (GET/HEAD, routing, error surfacing), status/slot calculations, and Redis storage lifecycle.

@gofurry gofurry requested a review from a team as a code owner June 26, 2026 10:37
@gofurry gofurry requested review from ReneWerner87, efectn, gaby and sixcolors and removed request for a team June 26, 2026 10:37
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new v3/uptime middleware with SQLite-backed heartbeat storage, snapshot/status APIs, an embedded dashboard UI, service lifecycle and maintenance logic, package documentation, and tests. Root and v3 indexes also link to the new package.

Changes

Uptime middleware

Layer / File(s) Summary
Docs
README.md, v3/README.md, v3/uptime/README.md
Adds the middleware index entries and the uptime README with setup, API, configuration, behavior, performance, concurrency, and security notes.
Contracts
v3/uptime/config.go, v3/uptime/internal/storage/types.go, v3/uptime/uptime_test.go
Defines uptime config defaults and validation, plus the storage interface and shared service, instance, heartbeat, status, and query option types; config tests cover defaults, validation, and DaysToShow clamping.
SQLite store
v3/uptime/internal/storage/sqlite.go, v3/uptime/internal/storage/sqlite_test.go
Implements SQLite initialization, schema setup, writes, rollups, cleanup, queries, and close handling for uptime data, with directory-creation coverage for file: URIs.
Snapshot model
v3/uptime/status.go, v3/uptime/status_test.go, v3/uptime/uptime_test.go
Builds cached status snapshots, per-day service states, expected-slot calculations, and date/slot helpers; tests cover slot-window math, cached snapshots, status derivation, and runtime-error preservation.
Dashboard UI
v3/uptime/ui.go, v3/uptime/dashboard.gohtml
Renders the embedded dashboard page and client-side refresh, status, and scroll behavior.
Service runtime
v3/uptime/uptime.go, v3/uptime/uptime_test.go
Initializes the store-backed service, routes requests, runs heartbeat and maintenance loops, and records runtime errors; tests cover handler behavior, lifecycle, constructor failures, integration wiring, and helpers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

v3, 📒 Documentation

Suggested reviewers

  • gaby
  • sixcolors
  • efectn

Poem

(_/)
(•_•) Hop, hop—new heartbeats softly bloom,
/ >🍃 a dashboard brightens up the room.
SQLite hums beneath the clover,
and every status bar says, “over!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a new Uptime middleware.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🤖 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 `@v3/uptime/config.go`:
- Around line 148-156: The threshold validation in Config validation only checks
ordering, so c.UI.GreenThreshold and c.UI.YellowThreshold can still accept
values outside the [0, 1] range. Update the validation logic in the Config
handling path to reject any out-of-range UI thresholds before the relative
comparison, keeping the existing error flow in place. Use the existing Config,
c.UI.GreenThreshold, and c.UI.YellowThreshold checks as the location to add the
percentage bounds validation.

In `@v3/uptime/internal/storage/sqlite.go`:
- Around line 296-299: ensureSQLiteDir is treating all file: URIs like in-memory
databases, which skips creating parent directories for disk-backed SQLite paths.
Update ensureSQLiteDir to special-case only :memory:, then for file: URIs strip
the scheme and any query string before running the existing MkdirAll logic so
on-disk targets like file:tmp/uptime.db?cache=shared get their parent directory
created. Use ensureSQLiteDir, strings.HasPrefix, and the directory creation path
to make the fix consistent with normal filesystem paths.

In `@v3/uptime/README.md`:
- Line 18: The preview image link in the README appears to contain a typo in the
repository name, using gofurry instead of gofiber. Update the Uptime dashboard
preview URL in the README image reference so it points to the correct host, and
verify the markdown image renders properly after the change.

In `@v3/uptime/status.go`:
- Around line 137-142: The `buildStatus` path in `Uptime` leaves stale storage
errors behind after a successful status query, so `storageStatus()` can keep
reporting degraded health. Update the successful return path in `buildStatus` to
clear the last recorded error by calling the existing `clearLastError` helper
before returning the `StatusResponse`, so current storage health is reflected
immediately.

In `@v3/uptime/ui.go`:
- Line 596: The page-scroll dock button’s accessible name should include both
the scroll progress and the scroll-up action. Update the button in the
page-scroll-dock markup so its aria-label/title still communicate that it is an
actionable control, using the existing scroll progress value together with
“scroll up”; apply the same fix wherever the dock label is set, including the
related page-scroll-dock update points.
- Around line 353-360: The focus styling for the uptime bars is removing the
keyboard focus indicator, making `.bar:focus-visible` hard to see. Update the
shared `.bar` hover/focus/active styles in the uptime UI so `:focus-visible`
keeps a clear visible outline or equivalent focus ring, while leaving the hover
and active visual treatment separate. Use the `.bar` selector group to locate
and adjust the focus-visible rule.
- Around line 619-623: The refresh flow in the uptime UI can overlap and hang
because it has no in-flight guard or request timeout. Update the refresh() logic
to track an active request and return early if one is already running, then add
AbortController-based timeout handling so slow API calls are cancelled instead
of piling up. Use the existing refresh() path and related status/state variables
like currentStatus, lastStatus, lastSuccessAt, and activeBar to place the guard
and abort cleanup in the right spot.

In `@v3/uptime/uptime_test.go`:
- Line 130: The dashboard date assertion is using the wrong day/month order and
should match year-month-day formatting. Update the UI date formatter where the
dashboard date string is built so it uses month before day, and adjust the
uptime test in uptime_test.go to assert against the corrected formatter output.
Use the existing date formatting logic and the test helper assertion around
bodyText to verify the new YYYY-MM-DD format.

In `@v3/uptime/uptime.go`:
- Around line 198-200: The HEAD shortcut in the uptime handler is bypassing the
same work that GET performs, so change the logic in the uptime request handler
to avoid returning early for fiber.MethodHead and instead run the
CachedSnapshot/dashboard rendering path first, only omitting the response body
at the end. Update the HEAD handling around the existing fiber.MethodHead checks
so any failure in snapshot loading or dashboard rendering is surfaced the same
way as GET, while still returning a HEAD-appropriate empty response on success.
- Around line 70-72: The uptime store initialization path in the startup logic
leaves the store open when `store.Init(ctx)` fails, unlike later failure paths
that clean up. Update the `uptime` setup flow so the `store` is closed before
returning from the `Init` error branch, using the existing `store.Close` cleanup
pattern in the same function to avoid leaking the SQLite handle or lock.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7071a71d-325b-4731-abb3-24f577275198

📥 Commits

Reviewing files that changed from the base of the PR and between c157076 and 21991ae.

⛔ Files ignored due to path filters (3)
  • .github/workflows/test-uptime.yml is excluded by !**/*.yml
  • v3/uptime/go.mod is excluded by !**/*.mod
  • v3/uptime/go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (10)
  • README.md
  • v3/README.md
  • v3/uptime/README.md
  • v3/uptime/config.go
  • v3/uptime/internal/storage/sqlite.go
  • v3/uptime/internal/storage/types.go
  • v3/uptime/status.go
  • v3/uptime/ui.go
  • v3/uptime/uptime.go
  • v3/uptime/uptime_test.go
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: lint / lint (v3/uptime)
  • GitHub Check: Tests (1.26.x)
🔇 Additional comments (4)
README.md (1)

37-37: LGTM!

v3/README.md (1)

35-35: LGTM!

v3/uptime/README.md (2)

137-142: Verify handler routing behavior claims.

The README statement is correct. The Handler() implementation in v3/uptime/uptime.go explicitly validates requests:

  • Lines 176‑178: Non‑GET/HEAD methods receive 405 Method Not Allowed with the Allow: GET, HEAD header.
  • Lines 181‑190: Paths other than the dashboard root or /api/status return 404 Not Found.

No changes are needed; the documented behavior matches the implementation.


91-92: Documentation accurately reflects implementation

The claims in the README are verified against the codebase:

  • "one open connection": sqlite.go explicitly calls SetMaxOpenConns(1).
  • Snapshot defaults: DisableCache defaults to false (cache enabled) and logic in config.go sets CacheTTL to SampleInterval if undefined.
  • UI defaults: defaultGreenThreshold is 0.999 (99.9%) and defaultYellowThreshold is 0.99 (99%).

No corrections needed.

Comment thread v3/uptime/config.go
Comment thread v3/uptime/internal/storage/sqlite.go Outdated
Comment thread v3/uptime/README.md
Comment thread v3/uptime/status.go
Comment thread v3/uptime/ui.go Outdated
Comment thread v3/uptime/ui.go Outdated
Comment thread v3/uptime/ui.go Outdated
Comment thread v3/uptime/uptime_test.go Outdated
Comment thread v3/uptime/uptime.go Outdated
Comment thread v3/uptime/uptime.go Outdated
Comment thread v3/uptime/ui.go Outdated
@ReneWerner87

Copy link
Copy Markdown
Member

@gofurry pls check #2038 (comment)
and also add dark mode based on the system settings

@gaby

gaby commented Jun 26, 2026

Copy link
Copy Markdown
Member

@gofurry I would suggest using https://github.com/gofiber/storage/tree/main/sqlite3 to create the sqlite db/connection and the using the Conn() to run custom queries against it. Instead of creating a full custom sqlite storage driver

@gofurry

gofurry commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@gofurry pls check #2038 (comment) and also add dark mode based on the system settings

Added system-based dark mode using prefers-color-scheme, without adding a theme switcher. The dashboard now keeps the light UI as the default and automatically adapts to the user's system preference.

QQ20260627-140647

@gofurry

gofurry commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@gofurry I would suggest using https://github.com/gofiber/storage/tree/main/sqlite3 to create the sqlite db/connection and the using the Conn() to run custom queries against it. Instead of creating a full custom sqlite storage driver

Thanks for the suggestion. I checked github.com/gofiber/storage/sqlite3/v2 and it currently uses github.com/mattn/go-sqlite3 under the hood.

Before I switch the uptime storage to use it via Conn(), I want to confirm whether introducing a CGO requirement is acceptable for this middleware. Moving to gofiber/storage/sqlite3/v2 would make consumers of the default SQLite-backed uptime middleware require CGO for builds.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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 `@v3/uptime/dashboard.gohtml`:
- Around line 591-593: The scroll button markup in the dashboard template mixes
plain button semantics with range-widget ARIA state; remove the aria-valuemin,
aria-valuemax, and aria-valuenow attributes from the page-scroll-dock control in
the template so it remains a standard button. Keep the accessible label/text on
the page-scroll-dock and page-scroll-dock-value elements for progress
information, and apply the same cleanup to the other matching scroll button
instance mentioned in the review.
- Around line 898-903: The scrollUpQuarter handler in the dashboard template
still forces smooth scrolling even when reduced-motion is preferred. Update the
scroll action to check the prefers-reduced-motion media query and use "auto"
instead of "smooth" when it matches, while keeping the existing behavior
otherwise. Refer to scrollUpQuarter and the window.scrollTo call to make the
change in the JS path.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f9c601f-ac6e-41e4-bde3-ec146f9d5e26

📥 Commits

Reviewing files that changed from the base of the PR and between dfc442d and 54f5654.

📒 Files selected for processing (8)
  • v3/uptime/config.go
  • v3/uptime/dashboard.gohtml
  • v3/uptime/internal/storage/sqlite.go
  • v3/uptime/internal/storage/sqlite_test.go
  • v3/uptime/status.go
  • v3/uptime/ui.go
  • v3/uptime/uptime.go
  • v3/uptime/uptime_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • v3/uptime/config.go
  • v3/uptime/status.go
  • v3/uptime/internal/storage/sqlite.go
  • v3/uptime/uptime.go
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: lint / lint (v3/coraza)
⚠️ CI failures not shown inline (4)

GitHub Actions: Test Uptime / Tests (1.26.x): feat: add uptime middleware

Conclusion: failure

View job details

##[group]Run case "2" in
 �[36;1mcase "2" in�[0m
 �[36;1m  ''|0)�[0m
 �[36;1m    # Reruns disabled: identical to the plain gotestsum invocation.�[0m
 �[36;1m    go run gotest.tools/gotestsum@v1.13.0 -f testname -- -race -count=1�[0m
 �[36;1m    ;;�[0m
 �[36;1m  *[!0-9]*)�[0m
 �[36;1m    echo "::error::rerun-fails must be a non-negative integer, got '2'"�[0m

GitHub Actions: Test Uptime / 0_Tests (1.26.x).txt: feat: add uptime middleware

Conclusion: failure

View job details

##[group]Run case "2" in
 �[36;1mcase "2" in�[0m
 �[36;1m  ''|0)�[0m
 �[36;1m    # Reruns disabled: identical to the plain gotestsum invocation.�[0m
 �[36;1m    go run gotest.tools/gotestsum@v1.13.0 -f testname -- -race -count=1�[0m
 �[36;1m    ;;�[0m
 �[36;1m  *[!0-9]*)�[0m
 �[36;1m    echo "::error::rerun-fails must be a non-negative integer, got '2'"�[0m

GitHub Actions: Test Uptime / 1_Tests (1.25.x).txt: feat: add uptime middleware

Conclusion: failure

View job details

##[group]Run case "2" in
 �[36;1mcase "2" in�[0m
 �[36;1m  ''|0)�[0m
 �[36;1m    # Reruns disabled: identical to the plain gotestsum invocation.�[0m
 �[36;1m    go run gotest.tools/gotestsum@v1.13.0 -f testname -- -race -count=1�[0m
 �[36;1m    ;;�[0m
 �[36;1m  *[!0-9]*)�[0m
 �[36;1m    echo "::error::rerun-fails must be a non-negative integer, got '2'"�[0m

GitHub Actions: Test Uptime / Tests (1.25.x): feat: add uptime middleware

Conclusion: failure

View job details

##[group]Run case "2" in
 �[36;1mcase "2" in�[0m
 �[36;1m  ''|0)�[0m
 �[36;1m    # Reruns disabled: identical to the plain gotestsum invocation.�[0m
 �[36;1m    go run gotest.tools/gotestsum@v1.13.0 -f testname -- -race -count=1�[0m
 �[36;1m    ;;�[0m
 �[36;1m  *[!0-9]*)�[0m
 �[36;1m    echo "::error::rerun-fails must be a non-negative integer, got '2'"�[0m
🔇 Additional comments (3)
v3/uptime/internal/storage/sqlite_test.go (1)

9-21: LGTM!

v3/uptime/ui.go (1)

5-5: LGTM!

Also applies to: 53-54

v3/uptime/uptime_test.go (1)

84-103: LGTM!

Also applies to: 150-155, 180-196, 234-250, 468-489, 583-587, 617-648

Comment thread v3/uptime/dashboard.gohtml Outdated
Comment thread v3/uptime/dashboard.gohtml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Fiber v3 uptime middleware package that records periodic heartbeats, stores/query uptime history via a Redis-backed store, and exposes a built-in HTML dashboard plus /api/status JSON endpoint. It also introduces a dedicated CI workflow and comprehensive tests for config validation, snapshot/status calculation, handler behavior, and storage lifecycle.

Changes:

  • Implemented the uptime runtime, handler routing, snapshot/status model, and embedded dashboard renderer.
  • Added a Redis-backed storage implementation (with rollups + retention cleanup) under internal/storage.
  • Added extensive unit tests, module files (go.mod/go.sum), docs, and a dedicated GitHub Actions workflow.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v3/uptime/uptime.go Core middleware runtime: background recording, maintenance, and handler routing.
v3/uptime/uptime_test.go Runtime/handler/config tests (routing, HEAD/GET, snapshot errors, ID generator, probes).
v3/uptime/ui.go Dashboard HTML rendering using embedded template + JSON payload injection.
v3/uptime/status.go Snapshot/status model and calculations (day ranges, expected slots, current up/down).
v3/uptime/status_test.go Tests for expected-slot calculations (including DST transitions).
v3/uptime/dashboard.gohtml Embedded dashboard template (CSS/JS) for rendering uptime UI.
v3/uptime/config.go Public configuration + normalization/validation for service and endpoint probe settings.
v3/uptime/README.md Package documentation, usage examples, config reference, and behavior notes.
v3/uptime/internal/storage/types.go Storage interface and shared data types for heartbeats and rollups.
v3/uptime/internal/storage/redis.go Redis store implementation for services, samples, daily rollups, and cleanup.
v3/uptime/internal/storage/redis_test.go Redis store tests including rollup/cleanup lifecycle and concurrency max-last-seen logic.
v3/uptime/go.mod New module for the uptime package and its dependencies.
v3/uptime/go.sum Dependency checksums for the uptime module.
.github/workflows/test-uptime.yml CI workflow to run uptime module tests (incl. race).
v3/README.md Adds uptime to the v3 middleware listing.
README.md Adds uptime to the repository’s main middleware listing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread v3/uptime/ui.go Outdated
Comment thread v3/uptime/config.go Outdated
Comment thread v3/uptime/config.go

@gaby gaby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated high-effort code review of the new uptime middleware. Candidates were gathered across 8 independent review angles and each surviving finding was independently verified against the code (and fiber v3.3.0 / fasthttp sources where framework behavior mattered); several were reproduced empirically with throwaway tests. 10 findings, most severe first:

  1. Shutdown panic/raceRedisStore.Close() nils the client while in-flight handlers can still call it; Fiber runs OnPreShutdown before draining requests (redis.go:369).
  2. Multi-instance data loss — concurrent rollup/cleanup across instances can permanently zero a correctly-finalized day (redis.go:169).
  3. Group mounting silently breaksc.Path() includes the group prefix, so app.Group("/admin").Use(uptime.New(...)) makes the dashboard 404 (uptime.go:274).
  4. Startup fragilityNew() panics on transient Redis errors (ping/upserts/initial heartbeat/maintenance) even though a degraded mode exists (uptime.go:74).
  5. Outage masking — the failed-probe path clears lastErr without any successful storage operation, flipping storage: "degraded" back to "ok" during a Redis outage (uptime.go:388).
  6. False red bars — today's expected slots include the in-progress slot while the heartbeat ticker isn't slot-aligned; healthy services render red/yellow for ~50 min after every midnight with defaults (status.go:169).
  7. 3xx probes impossible — the probe http.Client follows redirects, so ExpectedStatusCodes: []int{301} can never match (uptime.go:130).
  8. Unstoppable runtime — without optional Config.App there is no close path; goroutines leak and a stopped app keeps reporting "up" (uptime.go:231).
  9. Redis key leak — instance hashes are written every boot with no TTL, never read, never cleaned (redis.go:116).
  10. CI gap — the workflow paths filter misses the go:embed-ed dashboard.gohtml (test-uptime.yml:9).

Notable items that didn't make the top-10 cut: HEAD responses lose the entity Content-Length (fasthttp would suppress the body automatically if the handlers just wrote it); QueryDaily/QueryTodaySamples each re-call ListServices so one snapshot fetches the service list three times; the persisted uptime_rate field is never read back (status.go recomputes it) and rate() duplicates uptimeRate(); explicit GreenThreshold/YellowThreshold of 0 is silently replaced by defaults despite docs saying the range is [0, 1]; and the README example registers store.Close before the runtime's shutdown hook, so final heartbeats hit a closed client.


Generated by Claude Code

Comment thread v3/uptime/internal/storage/redis.go
Comment thread v3/uptime/internal/storage/redis.go
Comment thread v3/uptime/uptime.go Outdated
Comment thread v3/uptime/uptime.go
Comment thread v3/uptime/uptime.go Outdated
Comment thread v3/uptime/status.go
Comment thread v3/uptime/uptime.go Outdated
Comment thread v3/uptime/uptime.go
Comment thread v3/uptime/internal/storage/redis.go
Comment thread .github/workflows/test-uptime.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Comment thread v3/uptime/uptime.go Outdated
Comment on lines +109 to +119
targets := buildRecordTargets(cfg, now, instanceID)
for _, target := range targets {
if err := store.UpsertService(ctx, target.service); err != nil {
_ = store.Close()
return nil, fmt.Errorf("uptime: upsert service: %w", err)
}
if err := store.UpsertInstance(ctx, target.instance); err != nil {
_ = store.Close()
return nil, fmt.Errorf("uptime: upsert instance: %w", err)
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gofurry we should be close to merging after this fix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target registration now goes through the existing startup path. This avoids using the Redis client before Init() while preserving degraded startup behavior when Redis is temporarily unavailable.

Comment thread v3/uptime/uptime.go
gaby and others added 2 commits July 8, 2026 09:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants