Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes histogram metrics #1

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading