@@ -4,13 +4,19 @@ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentation
4
4
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto' ;
5
5
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' ;
6
6
import { Resource } from '@opentelemetry/resources' ;
7
+ import type {
8
+ PushMetricExporter } from '@opentelemetry/sdk-metrics' ;
7
9
import {
8
10
PeriodicExportingMetricReader ,
9
11
ConsoleMetricExporter ,
10
12
} from '@opentelemetry/sdk-metrics' ;
11
13
import { NodeSDK } from '@opentelemetry/sdk-node' ;
12
14
import { 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' ;
14
20
15
21
diag . setLogger ( new DiagConsoleLogger ( ) , DiagLogLevel . INFO ) ;
16
22
@@ -19,20 +25,26 @@ const traceExporter = new OTLPTraceExporter();
19
25
const sdk = new NodeSDK ( {
20
26
resource : new Resource ( {
21
27
[ 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' ,
23
32
[ 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' ,
27
39
} ) ,
28
40
spanProcessor : new SimpleSpanProcessor ( traceExporter ) ,
29
41
traceExporter,
30
42
metricReader : new PeriodicExportingMetricReader ( {
31
43
exporter :
32
44
process . env . NODE_ENV === 'production' ?
33
- new OTLPMetricExporter ( ) :
45
+ ( new OTLPMetricExporter ( ) as unknown as PushMetricExporter ) :
34
46
new ConsoleMetricExporter ( ) ,
35
- } ) ,
47
+ } ) as unknown as undefined ,
36
48
instrumentations : [
37
49
getNodeAutoInstrumentations ( {
38
50
'@opentelemetry/instrumentation-http' : {
0 commit comments