Skip to content

Add Spring Boot-style actuator endpoints (/manage/*) - #23

Open
Grizaster wants to merge 1 commit into
GOODBOY008:mainfrom
Grizaster:actuator-endpoints
Open

Add Spring Boot-style actuator endpoints (/manage/*)#23
Grizaster wants to merge 1 commit into
GOODBOY008:mainfrom
Grizaster:actuator-endpoints

Conversation

@Grizaster

Copy link
Copy Markdown

Overview

Adds Spring Boot-style management endpoints under /manage/ for operational monitoring of the HTTP server. The existing /health endpoint is kept for backwards compatibility.

Endpoints

Endpoint Description
GET /manage/health Health check with real disk space via statvfs (Unix)
GET /manage/info Build info: app name, version, architecture, OS, timezone, language
GET /manage/env Filtered environment variables — secrets (TOKEN, KEY, PASSWORD, SECRET, CREDENTIAL) are excluded
GET /manage/metrics Render metrics: total/PDF/failed counts, average render time, uptime

Implementation Details

  • Metrics tracked via AtomicU64 counters and Instant timer
  • failed_renders incremented on all error paths (render, PNG encode, image decode, PDF encode)
  • /manage/health reports real disk space values via statvfs (Unix) with 10MB threshold
  • /manage/env filters sensitive variables by name pattern
  • /manage/metrics reports avg_ms correctly (no erroneous unit conversion)

Dependencies

  • serde_json (optional, behind serve feature) for structured JSON responses
  • libc (Unix only, target-specific) for statvfs in /manage/health

Files Changed

  • src/main.rs — actuator endpoints, metrics tracking, shared app state
  • Cargo.tomlserde_json dependency + libc for Unix targets
  • Cargo.lock — updated

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

This PR adds Spring Boot-style “actuator” management endpoints under /manage/* to the serve (Axum HTTP server) mode, while keeping the legacy /health endpoint for backward compatibility.

Changes:

  • Adds /manage/health, /manage/info, /manage/env, and /manage/metrics endpoints and introduces shared in-memory metrics state.
  • Tracks basic render/request metrics using atomic counters and reports uptime.
  • Extends dependencies to support JSON responses (serde_json) and Unix disk stats via statvfs (libc).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/main.rs Adds management endpoints, shared AppState, disk-space health reporting, and render/request metrics collection.
Cargo.toml Adds serde_json for JSON responses and libc (Unix) for statvfs; updates serve feature deps.
Cargo.lock Locks new transitive dependencies from serde_json and libc.

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

Comment thread src/main.rs
Comment thread src/main.rs
Comment thread src/main.rs
Comment thread src/main.rs
Comment thread src/main.rs
Comment thread Cargo.toml
Adds /manage/* endpoints for operational monitoring:
- GET /manage/health: health check with real disk space (statvfs)
- GET /manage/info: build info (version, arch, OS, timezone, language)
- GET /manage/env: filtered env vars (secrets like TOKEN/KEY/PASSWORD
  excluded)
- GET /manage/metrics: render counts, avg render time, uptime

Metrics tracked via AtomicU64 counters. Existing /health kept for
backwards compatibility.

Dependencies: serde_json (optional, behind serve feature), libc
(Unix only, for statvfs).
@GOODBOY008
GOODBOY008 force-pushed the actuator-endpoints branch from 4e423d8 to 1b053b2 Compare July 20, 2026 05:49
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