From 29ecde067f2e9f82b23dc687c8b02d86e4b96609 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Mon, 6 Feb 2023 10:03:08 +0100 Subject: [PATCH] Add names and description to metrics --- Sources/App/CapServer.swift | 12 +++++++++--- Sources/App/configure.swift | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/App/CapServer.swift b/Sources/App/CapServer.swift index c1c63e7..7733070 100644 --- a/Sources/App/CapServer.swift +++ b/Sources/App/CapServer.swift @@ -460,9 +460,15 @@ final class CapServer { // MARK: Monitoring - private let capCountMetric = Metric("caps.count") + private let capCountMetric = Metric("caps.count", + name: "Number of caps", + description: "The total number of caps in the database") - private let imageCountMetric = Metric("caps.images") + private let imageCountMetric = Metric("caps.images", + name: "Total images", + description: "The total number of images for all caps") - private let classifierMetric = Metric("caps.classifier") + private let classifierMetric = Metric("caps.classifier", + name: "Classifier Version", + description: "The current version of the image classifier") } diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index 05971f5..38b453f 100755 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -18,7 +18,9 @@ public func configure(_ app: Application) throws { // All new metrics are automatically registered with the standard observer MetricObserver.standard = monitor - let status = Metric("caps.status") + let status = Metric("caps.status", + name: "Status", + description: "The general status of the service") status.update(.initializing) let server = CapServer(in: URL(fileURLWithPath: publicDirectory))