mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
fmt
This commit is contained in:
parent
7c7c584b78
commit
ab5f451929
3 changed files with 11 additions and 13 deletions
|
|
@ -14,7 +14,7 @@ import { relayConnectionsGauge, relayEventCounter, relayMessageCounter } from '@
|
|||
import * as pipeline from '@/pipeline.ts';
|
||||
import { RelayError } from '@/RelayError.ts';
|
||||
import { Storages } from '@/storages.ts';
|
||||
import { prometheusParams } from "@/db/KyselyLogger.ts";
|
||||
import { prometheusParams } from '@/db/KyselyLogger.ts';
|
||||
|
||||
/** Limit of initial events returned for a subscription. */
|
||||
const FILTER_LIMIT = 100;
|
||||
|
|
@ -57,12 +57,10 @@ function connectStream(socket: WebSocket) {
|
|||
try {
|
||||
const parsed = JSON.parse(msg[1].content);
|
||||
if (parsed.threshold) prometheusParams.threshold = parsed.threshold;
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
console.debug(`Error parsing kind 13314 ${msg[1].content}: ${e}`);
|
||||
}
|
||||
}
|
||||
else handleEvent(msg);
|
||||
} else handleEvent(msg);
|
||||
return;
|
||||
case 'CLOSE':
|
||||
handleClose(msg);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Logger } from 'kysely';
|
|||
import { dbQueryTime } from '@/metrics.ts';
|
||||
|
||||
export const prometheusParams = {
|
||||
threshold: 10000
|
||||
threshold: 10000,
|
||||
};
|
||||
|
||||
/** Log the SQL for queries. */
|
||||
|
|
@ -18,9 +18,9 @@ export const KyselyLogger: Logger = (event) => {
|
|||
const labels = {
|
||||
sql,
|
||||
parameters: JSON.stringify(
|
||||
parameters.filter((param: any) => ['string', 'number'].includes(typeof param)) as (string | number)[]
|
||||
)
|
||||
}
|
||||
parameters.filter((param: any) => ['string', 'number'].includes(typeof param)) as (string | number)[],
|
||||
),
|
||||
};
|
||||
dbQueryTime.observe(labels, queryDurationMillis);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Counter, Histogram, Gauge } from 'prom-client';
|
||||
import { Counter, Gauge, Histogram } from 'prom-client';
|
||||
|
||||
export const httpRequestCounter = new Counter({
|
||||
name: 'http_requests_total',
|
||||
|
|
@ -69,6 +69,6 @@ export const dbAvailableConnectionsGauge = new Gauge({
|
|||
});
|
||||
|
||||
export const dbQueryTime = new Histogram({
|
||||
name: "db_query_time",
|
||||
help: "Time taken per kysely query"
|
||||
})
|
||||
name: 'db_query_time',
|
||||
help: 'Time taken per kysely query',
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue