don't log metrics for postgres in testing
Some checks failed
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Test (backend) / e2e (22.11.0) (push) Failing after 1m48s
Test (production install and build) / production (22.11.0) (push) Successful in 1m16s
Publish Docker image / Build (push) Successful in 5m24s
Lint / pnpm_install (pull_request) Successful in 1m31s
Test (backend) / unit (22.11.0) (push) Has been cancelled
Test (backend) / e2e (22.11.0) (pull_request) Has been cancelled
Test (backend) / unit (22.11.0) (pull_request) Has been cancelled
Lint / lint (backend) (pull_request) Has been cancelled
Lint / lint (frontend) (pull_request) Has been cancelled
Lint / lint (frontend-embed) (pull_request) Has been cancelled
Lint / lint (frontend-shared) (pull_request) Has been cancelled
Lint / lint (misskey-bubble-game) (pull_request) Has been cancelled
Lint / lint (misskey-js) (pull_request) Has been cancelled
Lint / lint (misskey-reversi) (pull_request) Has been cancelled
Lint / lint (sw) (pull_request) Has been cancelled
Lint / typecheck (backend) (pull_request) Has been cancelled
Lint / typecheck (misskey-js) (pull_request) Has been cancelled
Lint / typecheck (sw) (pull_request) Has been cancelled
Lint / pnpm_install (push) Has been cancelled
Lint / lint (backend) (push) Has been cancelled
Lint / lint (frontend) (push) Has been cancelled
Lint / lint (frontend-embed) (push) Has been cancelled
Publish Docker image / Build (pull_request) Has been cancelled
Test (production install and build) / production (22.11.0) (pull_request) Has been cancelled
Some checks failed
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Test (backend) / e2e (22.11.0) (push) Failing after 1m48s
Test (production install and build) / production (22.11.0) (push) Successful in 1m16s
Publish Docker image / Build (push) Successful in 5m24s
Lint / pnpm_install (pull_request) Successful in 1m31s
Test (backend) / unit (22.11.0) (push) Has been cancelled
Test (backend) / e2e (22.11.0) (pull_request) Has been cancelled
Test (backend) / unit (22.11.0) (pull_request) Has been cancelled
Lint / lint (backend) (pull_request) Has been cancelled
Lint / lint (frontend) (pull_request) Has been cancelled
Lint / lint (frontend-embed) (pull_request) Has been cancelled
Lint / lint (frontend-shared) (pull_request) Has been cancelled
Lint / lint (misskey-bubble-game) (pull_request) Has been cancelled
Lint / lint (misskey-js) (pull_request) Has been cancelled
Lint / lint (misskey-reversi) (pull_request) Has been cancelled
Lint / lint (sw) (pull_request) Has been cancelled
Lint / typecheck (backend) (pull_request) Has been cancelled
Lint / typecheck (misskey-js) (pull_request) Has been cancelled
Lint / typecheck (sw) (pull_request) Has been cancelled
Lint / pnpm_install (push) Has been cancelled
Lint / lint (backend) (push) Has been cancelled
Lint / lint (frontend) (push) Has been cancelled
Lint / lint (frontend-embed) (push) Has been cancelled
Publish Docker image / Build (pull_request) Has been cancelled
Test (production install and build) / production (22.11.0) (pull_request) Has been cancelled
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
4d44adfaa9
commit
5961d29a11
6 changed files with 24 additions and 25 deletions
|
@ -7,11 +7,6 @@ import Redis from 'ioredis';
|
||||||
import { loadConfig } from '../built/config.js';
|
import { loadConfig } from '../built/config.js';
|
||||||
import { createPostgresDataSource } from '../built/postgres.js';
|
import { createPostgresDataSource } from '../built/postgres.js';
|
||||||
|
|
||||||
const timeout = setTimeout(() => {
|
|
||||||
console.error('Timeout while connecting to databases.');
|
|
||||||
process.exit(1);
|
|
||||||
}, 120000);
|
|
||||||
|
|
||||||
const config = loadConfig();
|
const config = loadConfig();
|
||||||
|
|
||||||
async function connectToPostgres() {
|
async function connectToPostgres() {
|
||||||
|
@ -59,5 +54,3 @@ const promises = Array
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await Promise.allSettled(promises);
|
await Promise.allSettled(promises);
|
||||||
|
|
||||||
clearTimeout(timeout);
|
|
||||||
|
|
|
@ -43,6 +43,12 @@ mBuildInfo.set({
|
||||||
node_version: process.version
|
node_version: process.version
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
const mStartupTime = new prom.Gauge({
|
||||||
|
name: 'misskey_startup_time',
|
||||||
|
help: 'Misskey startup time',
|
||||||
|
labelNames: ['pid']
|
||||||
|
});
|
||||||
|
|
||||||
function greet() {
|
function greet() {
|
||||||
if (!envOption.quiet) {
|
if (!envOption.quiet) {
|
||||||
//#region Misskey logo
|
//#region Misskey logo
|
||||||
|
@ -112,6 +118,8 @@ export async function masterMain() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mStartupTime.set({ pid: process.pid }, Date.now());
|
||||||
|
|
||||||
if (envOption.disableClustering) {
|
if (envOption.disableClustering) {
|
||||||
if (envOption.onlyServer) {
|
if (envOption.onlyServer) {
|
||||||
await server();
|
await server();
|
||||||
|
|
|
@ -31,16 +31,18 @@ export type UserWebhookDeliverQueue = Bull.Queue<UserWebhookDeliverJobData>;
|
||||||
export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>;
|
export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>;
|
||||||
|
|
||||||
function withMetrics<T>(queue: Bull.Queue<T>): Bull.Queue<T> {
|
function withMetrics<T>(queue: Bull.Queue<T>): Bull.Queue<T> {
|
||||||
setInterval(async () => {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
mActiveJobs.set({ queue: queue.name }, await queue.getActiveCount());
|
setInterval(async () => {
|
||||||
mDelayedJobs.set({ queue: queue.name }, await queue.getDelayedCount());
|
mActiveJobs.set({ queue: queue.name }, await queue.getActiveCount());
|
||||||
mWaitingJobs.set({ queue: queue.name }, await queue.getWaitingCount());
|
mDelayedJobs.set({ queue: queue.name }, await queue.getDelayedCount());
|
||||||
}, 2000);
|
mWaitingJobs.set({ queue: queue.name }, await queue.getWaitingCount());
|
||||||
|
}, 2000);
|
||||||
queue.on('waiting', () => {
|
|
||||||
mJobReceivedCounter.inc({ queue: queue.name });
|
|
||||||
});
|
|
||||||
|
|
||||||
|
queue.on('waiting', () => {
|
||||||
|
mJobReceivedCounter.inc({ queue: queue.name });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,8 @@ export function createPostgresDataSource(config: Config, isMain = false) {
|
||||||
},
|
},
|
||||||
} : false,
|
} : false,
|
||||||
logging: log ? 'all' : ['query'],
|
logging: log ? 'all' : ['query'],
|
||||||
logger: (isMain || log) ? new MyCustomLogger(!log) : undefined,
|
logger: process.env.NODE_ENV === 'test' ? undefined :
|
||||||
|
(isMain || log) ? new MyCustomLogger(!log) : undefined,
|
||||||
maxQueryExecutionTime: 500,
|
maxQueryExecutionTime: 500,
|
||||||
entities: entities,
|
entities: entities,
|
||||||
migrations: ['../../migration/*.js'],
|
migrations: ['../../migration/*.js'],
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class MetricsService {
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
|
public createServer(fastify: FastifyInstance) {
|
||||||
if (this.config.prometheusMetrics?.enable) {
|
if (this.config.prometheusMetrics?.enable) {
|
||||||
const token = this.config.prometheusMetrics.scrapeToken;
|
const token = this.config.prometheusMetrics.scrapeToken;
|
||||||
fastify.get('/metrics', async (request, reply) => {
|
fastify.get('/metrics', async (request, reply) => {
|
||||||
|
@ -46,7 +46,5 @@ export class MetricsService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
done();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { NestFactory } from '@nestjs/core';
|
||||||
import { MainModule } from '@/MainModule.js';
|
import { MainModule } from '@/MainModule.js';
|
||||||
import { ServerService } from '@/server/ServerService.js';
|
import { ServerService } from '@/server/ServerService.js';
|
||||||
import { loadConfig } from '@/config.js';
|
import { loadConfig } from '@/config.js';
|
||||||
import { NestLogger } from '@/NestLogger.js';
|
|
||||||
import { INestApplicationContext } from '@nestjs/common';
|
import { INestApplicationContext } from '@nestjs/common';
|
||||||
|
|
||||||
const config = loadConfig();
|
const config = loadConfig();
|
||||||
|
@ -22,10 +21,8 @@ let serverService: ServerService;
|
||||||
async function launch() {
|
async function launch() {
|
||||||
await killTestServer();
|
await killTestServer();
|
||||||
|
|
||||||
console.log('starting application...');
|
|
||||||
|
|
||||||
app = await NestFactory.createApplicationContext(MainModule, {
|
app = await NestFactory.createApplicationContext(MainModule, {
|
||||||
logger: new NestLogger(),
|
logger: ["debug", "log", "error", "warn", "verbose"],
|
||||||
});
|
});
|
||||||
serverService = app.get(ServerService);
|
serverService = app.get(ServerService);
|
||||||
await serverService.launch();
|
await serverService.launch();
|
||||||
|
@ -84,7 +81,7 @@ async function startControllerEndpoints(port = config.port + 1000) {
|
||||||
console.log('starting application...');
|
console.log('starting application...');
|
||||||
|
|
||||||
app = await NestFactory.createApplicationContext(MainModule, {
|
app = await NestFactory.createApplicationContext(MainModule, {
|
||||||
logger: new NestLogger(),
|
logger: ["debug", "log", "error", "warn", "verbose"],
|
||||||
});
|
});
|
||||||
serverService = app.get(ServerService);
|
serverService = app.get(ServerService);
|
||||||
await serverService.launch();
|
await serverService.launch();
|
||||||
|
|
Loading…
Reference in a new issue