1+ // Copyright The OpenTelemetry Authors
2+ // SPDX-License-Identifier: Apache-2.0
3+
4+ // const { start } = require('@splunk/otel');
5+
6+ // start({
7+ // serviceName: 'my-node-service',
8+ // endpoint: 'http://localhost:4317'
9+ // });
10+ // const opentelemetry = require("@opentelemetry/sdk-node")
11+ // const {getNodeAutoInstrumentations} = require("@opentelemetry/auto-instrumentations-node")
12+ // const {OTLPTraceExporter} = require('@opentelemetry/exporter-trace-otlp-grpc')
13+ // const {OTLPMetricExporter} = require('@opentelemetry/exporter-metrics-otlp-grpc')
14+ // const {PeriodicExportingMetricReader} = require('@opentelemetry/sdk-metrics')
15+ // const {alibabaCloudEcsDetector} = require('@opentelemetry/resource-detector-alibaba-cloud')
16+ // const {awsEc2Detector, awsEksDetector} = require('@opentelemetry/resource-detector-aws')
17+ // const {containerDetector} = require('@opentelemetry/resource-detector-container')
18+ // const {gcpDetector} = require('@opentelemetry/resource-detector-gcp')
19+ // const {envDetector, hostDetector, osDetector, processDetector} = require('@opentelemetry/resources')
20+ // const {RuntimeNodeInstrumentation} = require('@opentelemetry/instrumentation-runtime-node')
21+
22+ // const sdk = new opentelemetry.NodeSDK({
23+ // traceExporter: new OTLPTraceExporter(),
24+ // instrumentations: [
25+ // getNodeAutoInstrumentations({
26+ // // only instrument fs if it is part of another trace
27+ // '@opentelemetry/instrumentation-fs': {
28+ // requireParentSpan: true,
29+ // },
30+ // }),
31+ // new RuntimeNodeInstrumentation({
32+ // monitoringPrecision: 5000,
33+ // })
34+ // ],
35+ // metricReader: new PeriodicExportingMetricReader({
36+ // exporter: new OTLPMetricExporter()
37+ // }),
38+ // resourceDetectors: [
39+ // containerDetector,
40+ // envDetector,
41+ // hostDetector,
42+ // osDetector,
43+ // processDetector,
44+ // alibabaCloudEcsDetector,
45+ // awsEksDetector,
46+ // awsEc2Detector,
47+ // gcpDetector
48+ // ],
49+ // })
50+
51+ // sdk.start();
52+ const { start } = require ( '@splunk/otel' ) ;
53+ // Print relevant OTEL/Splunk environment variables
54+ console . log ( '=== OpenTelemetry Environment Variables ===' ) ;
55+ [
56+ 'OTEL_SERVICE_NAME' ,
57+ 'OTEL_EXPORTER_OTLP_ENDPOINT' ,
58+ 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT' ,
59+ //'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
60+ 'OTEL_RESOURCE_ATTRIBUTES' ,
61+ 'SPLUNK_PROFILER_ENABLED' ,
62+ 'SPLUNK_PROFILER_MEMORY_ENABLED' ,
63+ 'SPLUNK_PROFILER_CALL_STACK_INTERVAL' ,
64+ 'OTEL_PROFILER_LOGS_ENDPOINT' ,
65+ 'OTEL_LOG_LEVEL'
66+ ] . forEach ( ( key ) => {
67+ if ( process . env [ key ] ) {
68+ console . log ( `${ key } : ${ process . env [ key ] } ` ) ;
69+ } else {
70+ console . log ( `${ key } : (not set)` ) ;
71+ }
72+ } ) ;
73+
74+ console . log ( '===========================================' ) ;
75+
76+ start ( ) ;
0 commit comments