Compare commits

...

2 Commits

Author SHA1 Message Date
a14795f347 v1.7.3 2023-11-11 23:01:54 +02:00
69021a5c8e make metric buckets configurable 2023-11-11 23:01:39 +02:00
3 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@navy.gif/wrappers",
"version": "1.7.2",
"version": "1.7.3",
"description": "Various wrapper classes I use in my projects",
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
"author": "Navy.gif",

View File

@ -26,7 +26,8 @@ export type MariaOptions = {
credentials: Credentials,
loggerOptions?: LoggerClientOptions,
donorQuery?: boolean,
recordMetrics?: boolean
recordMetrics?: boolean,
metricsBuckets?: number[],
}
type MariaError = {
@ -247,7 +248,7 @@ class MariaDB
MariaDB.#queryHistogram = new Prometheus.Histogram({
name: 'sql_queries',
help: 'Tracks query duration in seconds and frequency',
buckets: Prometheus?.exponentialBuckets(0.005, 2, 10),
buckets: this.#config.metricsBuckets ?? Prometheus?.exponentialBuckets(0.005, 2, 10),
labelNames: [ 'type' ] as const
});
this.#server.registerMetric(MariaDB.#queryHistogram!);

View File

@ -22,7 +22,8 @@ export type MongoOptions = {
loggerOptions?: LoggerClientOptions,
client?: MongoClientOptions,
load?: boolean,
recordMetrics?: boolean
recordMetrics?: boolean,
metricsBuckets?: number[],
}
type StringIndexable = {[key: string]: boolean | string | number | Document | object}
@ -151,7 +152,7 @@ class MongoDB
MongoDB.#queryHistogram = new Prometheus.Histogram({
name: 'mongo_queries',
help: 'Tracks query duration in seconds and frequency',
buckets: Prometheus?.exponentialBuckets(0.005, 2, 10),
buckets: this.#config.metricsBuckets ?? Prometheus?.exponentialBuckets(0.005, 2, 10),
labelNames: [ 'type' ] as const
});
this.#server.registerMetric(MongoDB.#queryHistogram!);