Skip to content

Commit

Permalink
Merge pull request #1 from TheAntiCarCollective/bugfix/metrics
Browse files Browse the repository at this point in the history
Fixes histogram metrics
  • Loading branch information
danthonywalker authored Oct 13, 2023
2 parents 7bb5104 + 2ab986d commit 6bd2644
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/shared/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ import type {
import { Client, Events, Routes, User } from "discord.js";
import assert from "node:assert";
import loggerFactory from "pino";
import { Histogram, exponentialBuckets } from "prom-client";
import { Histogram } from "prom-client";

// region Logger and Metrics
const logger = loggerFactory({
name: __filename,
});

const interactionRequestDuration = new Histogram({
// Create 9 buckets, starting on 10 and with a factor of 2
buckets: exponentialBuckets(10, 2, 9),
help: "Interaction request duration in milliseconds",
labelNames: ["status", "handler"],
name: "interaction_request_duration_milliseconds",
Expand Down
4 changes: 1 addition & 3 deletions src/shared/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PoolClient } from "pg";

import { Pool } from "pg";
import loggerFactory from "pino";
import { Histogram, exponentialBuckets } from "prom-client";
import { Histogram } from "prom-client";

import type { Caller } from "./caller";

Expand All @@ -18,8 +18,6 @@ const logger = loggerFactory({
});

const databaseRequestDuration = new Histogram({
// Create 11 buckets, starting on 1 and with a factor of 2
buckets: exponentialBuckets(1, 2, 11),
help: "Database request duration in milliseconds",
labelNames: ["caller", "status", "connected"],
name: "database_request_duration_milliseconds",
Expand Down

0 comments on commit 6bd2644

Please sign in to comment.