@@ -4,13 +4,19 @@ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentation
44import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto' ;
55import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' ;
66import { Resource } from '@opentelemetry/resources' ;
7+ import type {
8+ PushMetricExporter } from '@opentelemetry/sdk-metrics' ;
79import {
810 PeriodicExportingMetricReader ,
911 ConsoleMetricExporter ,
1012} from '@opentelemetry/sdk-metrics' ;
1113import { NodeSDK } from '@opentelemetry/sdk-node' ;
1214import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node' ;
13- import { SEMRESATTRS_SERVICE_NAME , SEMRESATTRS_SERVICE_VERSION , SEMRESATTRS_SERVICE_INSTANCE_ID } from '@opentelemetry/semantic-conventions' ;
15+ import {
16+ SEMRESATTRS_SERVICE_NAME ,
17+ SEMRESATTRS_SERVICE_VERSION ,
18+ SEMRESATTRS_SERVICE_INSTANCE_ID ,
19+ } from '@opentelemetry/semantic-conventions' ;
1420
1521diag . setLogger ( new DiagConsoleLogger ( ) , DiagLogLevel . INFO ) ;
1622
@@ -19,20 +25,26 @@ const traceExporter = new OTLPTraceExporter();
1925const sdk = new NodeSDK ( {
2026 resource : new Resource ( {
2127 [ SEMRESATTRS_SERVICE_NAME ] : 'blockscout_frontend' ,
22- [ SEMRESATTRS_SERVICE_VERSION ] : process . env . NEXT_PUBLIC_GIT_TAG || process . env . NEXT_PUBLIC_GIT_COMMIT_SHA || 'unknown_version' ,
28+ [ SEMRESATTRS_SERVICE_VERSION ] :
29+ process . env . NEXT_PUBLIC_GIT_TAG ||
30+ process . env . NEXT_PUBLIC_GIT_COMMIT_SHA ||
31+ 'unknown_version' ,
2332 [ SEMRESATTRS_SERVICE_INSTANCE_ID ] :
24- process . env . NEXT_PUBLIC_APP_INSTANCE ||
25- process . env . NEXT_PUBLIC_APP_HOST ?. replace ( '.blockscout.com' , '' ) . replaceAll ( '-' , '_' ) ||
26- 'unknown_app' ,
33+ process . env . NEXT_PUBLIC_APP_INSTANCE ||
34+ process . env . NEXT_PUBLIC_APP_HOST ?. replace (
35+ '.blockscout.com' ,
36+ '' ,
37+ ) . replaceAll ( '-' , '_' ) ||
38+ 'unknown_app' ,
2739 } ) ,
2840 spanProcessor : new SimpleSpanProcessor ( traceExporter ) ,
2941 traceExporter,
3042 metricReader : new PeriodicExportingMetricReader ( {
3143 exporter :
3244 process . env . NODE_ENV === 'production' ?
33- new OTLPMetricExporter ( ) :
45+ ( new OTLPMetricExporter ( ) as unknown as PushMetricExporter ) :
3446 new ConsoleMetricExporter ( ) ,
35- } ) ,
47+ } ) as unknown as undefined ,
3648 instrumentations : [
3749 getNodeAutoInstrumentations ( {
3850 '@opentelemetry/instrumentation-http' : {
0 commit comments