reduce buckets for incoming ap
Some checks failed
Lint / pnpm_install (push) Successful in 2m4s
Publish Docker image / Build (push) Successful in 5m4s
Test (production install and build) / production (22.11.0) (push) Successful in 1m5s
Lint / lint (backend) (push) Successful in 2m18s
Test (backend) / unit (22.11.0) (push) Successful in 8m58s
Lint / lint (frontend) (push) Successful in 2m26s
Lint / lint (frontend-embed) (push) Successful in 2m30s
Lint / lint (frontend-shared) (push) Successful in 2m26s
Lint / lint (misskey-bubble-game) (push) Successful in 2m41s
Test (backend) / e2e (22.11.0) (push) Successful in 12m10s
Lint / lint (misskey-js) (push) Successful in 2m36s
Lint / lint (misskey-reversi) (push) Successful in 2m43s
Lint / lint (sw) (push) Successful in 2m41s
Lint / typecheck (backend) (push) Has been cancelled
Lint / typecheck (misskey-js) (push) Has been cancelled
Lint / typecheck (sw) (push) Has been cancelled
Lint / pnpm_install (pull_request) Successful in 2m1s
Publish Docker image / Build (pull_request) Successful in 4m32s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m6s
Test (backend) / unit (22.11.0) (pull_request) Successful in 8m55s
Test (backend) / e2e (22.11.0) (pull_request) Failing after 11m40s
Lint / lint (backend) (pull_request) Successful in 2m14s
Lint / lint (frontend) (pull_request) Successful in 2m12s
Lint / lint (frontend-embed) (pull_request) Successful in 2m19s
Lint / lint (frontend-shared) (pull_request) Successful in 2m27s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m22s
Lint / lint (misskey-js) (pull_request) Successful in 2m22s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m32s
Lint / lint (sw) (pull_request) Successful in 2m36s
Lint / typecheck (backend) (pull_request) Successful in 2m30s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m40s
Lint / typecheck (sw) (pull_request) Successful in 1m42s
Some checks failed
Lint / pnpm_install (push) Successful in 2m4s
Publish Docker image / Build (push) Successful in 5m4s
Test (production install and build) / production (22.11.0) (push) Successful in 1m5s
Lint / lint (backend) (push) Successful in 2m18s
Test (backend) / unit (22.11.0) (push) Successful in 8m58s
Lint / lint (frontend) (push) Successful in 2m26s
Lint / lint (frontend-embed) (push) Successful in 2m30s
Lint / lint (frontend-shared) (push) Successful in 2m26s
Lint / lint (misskey-bubble-game) (push) Successful in 2m41s
Test (backend) / e2e (22.11.0) (push) Successful in 12m10s
Lint / lint (misskey-js) (push) Successful in 2m36s
Lint / lint (misskey-reversi) (push) Successful in 2m43s
Lint / lint (sw) (push) Successful in 2m41s
Lint / typecheck (backend) (push) Has been cancelled
Lint / typecheck (misskey-js) (push) Has been cancelled
Lint / typecheck (sw) (push) Has been cancelled
Lint / pnpm_install (pull_request) Successful in 2m1s
Publish Docker image / Build (pull_request) Successful in 4m32s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m6s
Test (backend) / unit (22.11.0) (pull_request) Successful in 8m55s
Test (backend) / e2e (22.11.0) (pull_request) Failing after 11m40s
Lint / lint (backend) (pull_request) Successful in 2m14s
Lint / lint (frontend) (pull_request) Successful in 2m12s
Lint / lint (frontend-embed) (pull_request) Successful in 2m19s
Lint / lint (frontend-shared) (pull_request) Successful in 2m27s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m22s
Lint / lint (misskey-js) (pull_request) Successful in 2m22s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m32s
Lint / lint (sw) (pull_request) Successful in 2m36s
Lint / typecheck (backend) (pull_request) Successful in 2m30s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m40s
Lint / typecheck (sw) (pull_request) Successful in 1m42s
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
f9167b8b86
commit
3390f01128
1 changed files with 5 additions and 12 deletions
|
@ -95,7 +95,6 @@ const sqlLogger = dbLogger.createSubLogger('sql', 'gray');
|
||||||
type QueryTagCache = {
|
type QueryTagCache = {
|
||||||
join: string;
|
join: string;
|
||||||
from: string;
|
from: string;
|
||||||
hash: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function dedupConsecutive<T>(arr: T[]): T[] {
|
function dedupConsecutive<T>(arr: T[]): T[] {
|
||||||
|
@ -107,40 +106,34 @@ function simplifyIdentifiers(sql: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractQueryTags(query: string): QueryTagCache {
|
function extractQueryTags(query: string): QueryTagCache {
|
||||||
const joins = query.matchAll(/(LEFT|RIGHT|INNER|OUTER) JOIN ([a-zA-Z0-9_"`.\s]+) ON/ig);
|
const joins = query.matchAll(/(LEFT|RIGHT|INNER|OUTER)[\s\S]+JOIN[\s\r\n]+([a-zA-Z0-9_"`.]+)/ig);
|
||||||
const froms = query.matchAll(/FROM ([a-zA-Z0-9_"`.]+)/ig);
|
const froms = query.matchAll(/FROM[\s\r\n]+([a-zA-Z0-9_"`.]+)/ig);
|
||||||
|
|
||||||
const join = Array.from(joins).map(j => `${j[1]}:${simplifyIdentifiers(j[2])}`).join('|');
|
const join = Array.from(joins).map(j => `${j[1]}:${simplifyIdentifiers(j[2])}`).join('|');
|
||||||
const from = dedupConsecutive(Array.from(froms).map(f => simplifyIdentifiers(f[1]))).join('|');
|
const from = dedupConsecutive(Array.from(froms).map(f => simplifyIdentifiers(f[1]))).join('|');
|
||||||
|
|
||||||
// this is not for security just to reduce metrics size just for confirmation in local environment
|
|
||||||
// all the code is public there is nothing secret in the query itself
|
|
||||||
const hash = createHash('md5');
|
|
||||||
hash.update(query);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
join,
|
join,
|
||||||
from,
|
from,
|
||||||
hash: hash.digest('hex'),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const mQueryCounter = metricCounter({
|
const mQueryCounter = metricCounter({
|
||||||
name: 'misskey_postgres_query_total',
|
name: 'misskey_postgres_query_total',
|
||||||
help: 'Total queries to postgres',
|
help: 'Total queries to postgres',
|
||||||
labelNames: ['join', 'from', 'hash'],
|
labelNames: ['join', 'from'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const mQueryErrorCounter = metricCounter({
|
const mQueryErrorCounter = metricCounter({
|
||||||
name: 'misskey_postgres_query_error_total',
|
name: 'misskey_postgres_query_error_total',
|
||||||
help: 'Total errors in queries to postgres',
|
help: 'Total errors in queries to postgres',
|
||||||
labelNames: ['join', 'from', 'hash'],
|
labelNames: ['join', 'from'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const mSlowQueryHisto = metricHistogram({
|
const mSlowQueryHisto = metricHistogram({
|
||||||
name: 'misskey_postgres_query_slow_duration_seconds',
|
name: 'misskey_postgres_query_slow_duration_seconds',
|
||||||
help: 'Duration of slow queries to postgres',
|
help: 'Duration of slow queries to postgres',
|
||||||
labelNames: ['join', 'from', 'hash'],
|
labelNames: ['join', 'from'],
|
||||||
buckets: [0.1, 0.5, 1, 2, 5, 10, 30, 300],
|
buckets: [0.1, 0.5, 1, 2, 5, 10, 30, 300],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue