mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-17 19:36:28 +02:00
Merge pull request #633 from sw1nn/main
feat(metrics): add bambuddy_build_info metric
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
"""Prometheus metrics endpoint for external monitoring."""
|
||||
|
||||
import platform
|
||||
|
||||
from fastapi import APIRouter, Depends, Header, HTTPException, Response
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from backend.app.core.config import APP_VERSION
|
||||
from backend.app.core.database import get_db
|
||||
from backend.app.models.archive import PrintArchive
|
||||
from backend.app.models.print_queue import PrintQueueItem
|
||||
@@ -77,6 +80,20 @@ async def get_metrics(
|
||||
|
||||
lines: list[str] = []
|
||||
|
||||
# =========================================================================
|
||||
# Build info
|
||||
# =========================================================================
|
||||
|
||||
lines.append("# HELP bambuddy_build_info Build and version information")
|
||||
lines.append("# TYPE bambuddy_build_info gauge")
|
||||
build_labels = format_labels(
|
||||
version=APP_VERSION,
|
||||
python_version=platform.python_version(),
|
||||
platform=platform.system(),
|
||||
architecture=platform.machine(),
|
||||
)
|
||||
lines.append(f"bambuddy_build_info{build_labels} 1")
|
||||
|
||||
# =========================================================================
|
||||
# Printer metrics
|
||||
# =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user