Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-db/src/redis/metrics.ts
2500 views
1
/**
2
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import * as client from "prom-client";
8
9
const registry = new client.Registry();
10
11
export function redisMetricsRegistry(): client.Registry {
12
return registry;
13
}
14
15
export const updatesPublishedTotal = new client.Counter({
16
name: "gitpod_redis_updates_published_total",
17
help: "Counter of events published to Redis by type and error",
18
labelNames: ["type", "error"],
19
registers: [registry],
20
});
21
22
export function reportUpdatePublished(type: "workspace-instance" | "prebuild" | "headless", err?: Error): void {
23
updatesPublishedTotal.labels(type, err ? "true" : "false").inc();
24
}
25
26