| 11 | export const tracer = getTracer(); |
| 12 | |
| 13 | function getTracer() { |
| 14 | diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR); |
| 15 | |
| 16 | const provider = new NodeTracerProvider({ |
| 17 | forceFlushTimeoutMillis: 500, |
| 18 | resource: new Resource({ |
| 19 | [SEMRESATTRS_SERVICE_NAME]: "v3-catalog", |
| 20 | }), |
| 21 | }); |
| 22 | |
| 23 | const loggerExporter = new ConsoleSpanExporter(); |
| 24 | provider.addSpanProcessor(new SimpleSpanProcessor(loggerExporter)); |
| 25 | |
| 26 | provider.register(); |
| 27 | |
| 28 | let instrumentations: InstrumentationOption[] = [ |
| 29 | new HttpInstrumentation(), |
| 30 | new FetchInstrumentation(), |
| 31 | new UndiciInstrumentation(), |
| 32 | ]; |
| 33 | |
| 34 | registerInstrumentations({ |
| 35 | tracerProvider: provider, |
| 36 | instrumentations, |
| 37 | }); |
| 38 | |
| 39 | return provider.getTracer("v3-catalog", "3.0.0.dp.1"); |
| 40 | } |