Add names and description to metrics

This commit is contained in:
Christoph Hagen 2023-02-06 10:03:08 +01:00
parent 600464b889
commit 29ecde067f
2 changed files with 12 additions and 4 deletions

View File

@ -460,9 +460,15 @@ final class CapServer {
// MARK: Monitoring // MARK: Monitoring
private let capCountMetric = Metric<Int>("caps.count") private let capCountMetric = Metric<Int>("caps.count",
name: "Number of caps",
description: "The total number of caps in the database")
private let imageCountMetric = Metric<Int>("caps.images") private let imageCountMetric = Metric<Int>("caps.images",
name: "Total images",
description: "The total number of images for all caps")
private let classifierMetric = Metric<Int>("caps.classifier") private let classifierMetric = Metric<Int>("caps.classifier",
name: "Classifier Version",
description: "The current version of the image classifier")
} }

View File

@ -18,7 +18,9 @@ public func configure(_ app: Application) throws {
// All new metrics are automatically registered with the standard observer // All new metrics are automatically registered with the standard observer
MetricObserver.standard = monitor MetricObserver.standard = monitor
let status = Metric<ServerStatus>("caps.status") let status = Metric<ServerStatus>("caps.status",
name: "Status",
description: "The general status of the service")
status.update(.initializing) status.update(.initializing)
let server = CapServer(in: URL(fileURLWithPath: publicDirectory)) let server = CapServer(in: URL(fileURLWithPath: publicDirectory))