mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
refactor(server): standarderlize metrics and trace with OTEL (#5054)
you can now export span to Zipkin and metrics to Prometheus when developing locally follow the docs of OTEL: https://opentelemetry.io/docs/instrumentation/js/exporters/ <img width="2357" alt="image" src="https://github.com/toeverything/AFFiNE/assets/8281226/ec615e1f-3e91-43f7-9111-d7d2629e9679">
This commit is contained in:
@@ -8,14 +8,13 @@ import { fileURLToPath } from 'url';
|
||||
|
||||
import { Config } from './config';
|
||||
import { GQLLoggerPlugin } from './graphql/logger-plugin';
|
||||
import { Metrics } from './metrics/metrics';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [
|
||||
GraphQLModule.forRootAsync<ApolloDriverConfig>({
|
||||
driver: ApolloDriver,
|
||||
useFactory: (config: Config, metrics: Metrics) => {
|
||||
useFactory: (config: Config) => {
|
||||
return {
|
||||
...config.graphql,
|
||||
path: `${config.path}/graphql`,
|
||||
@@ -31,10 +30,10 @@ import { Metrics } from './metrics/metrics';
|
||||
req,
|
||||
res,
|
||||
}),
|
||||
plugins: [new GQLLoggerPlugin(metrics)],
|
||||
plugins: [new GQLLoggerPlugin()],
|
||||
};
|
||||
},
|
||||
inject: [Config, Metrics],
|
||||
inject: [Config],
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user