add metrics to api
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
"@openpanel/trpc": "workspace:*",
|
||||
"@trpc/server": "^10.45.1",
|
||||
"fastify": "^4.25.2",
|
||||
"fastify-metrics": "^11.0.0",
|
||||
"ico-to-png": "^0.2.1",
|
||||
"pino": "^8.17.2",
|
||||
"pino-pretty": "^10.3.1",
|
||||
|
||||
@@ -4,6 +4,7 @@ import cors from '@fastify/cors';
|
||||
import type { FastifyTRPCPluginOptions } from '@trpc/server/adapters/fastify';
|
||||
import { fastifyTRPCPlugin } from '@trpc/server/adapters/fastify';
|
||||
import Fastify from 'fastify';
|
||||
import metricsPlugin from 'fastify-metrics';
|
||||
|
||||
import type { IServiceClient } from '@openpanel/db';
|
||||
import { redisPub } from '@openpanel/redis';
|
||||
@@ -33,6 +34,8 @@ const startServer = async () => {
|
||||
maxParamLength: 15_000,
|
||||
});
|
||||
|
||||
await fastify.register(metricsPlugin, { endpoint: '/metrics' });
|
||||
|
||||
fastify.register(cors, {
|
||||
origin: '*',
|
||||
credentials: true,
|
||||
|
||||
Reference in New Issue
Block a user