1+ /*
2+ * Copyright The OpenTelemetry Authors
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117'use strict' ;
218
319const opentelemetry = require ( '@opentelemetry/api' ) ;
@@ -7,14 +23,19 @@ diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.VERBOSE);
723
824const { registerInstrumentations } = require ( '@opentelemetry/instrumentation' ) ;
925const { NodeTracerProvider } = require ( '@opentelemetry/sdk-trace-node' ) ;
10- const { SimpleSpanProcessor, ConsoleSpanExporter } = require ( '@opentelemetry/sdk-trace-base' ) ;
26+ const {
27+ SimpleSpanProcessor,
28+ ConsoleSpanExporter,
29+ } = require ( '@opentelemetry/sdk-trace-base' ) ;
1130const { JaegerExporter } = require ( '@opentelemetry/exporter-jaeger' ) ;
1231const { ZipkinExporter } = require ( '@opentelemetry/exporter-zipkin' ) ;
1332
1433const { HttpInstrumentation } = require ( '@opentelemetry/instrumentation-http' ) ;
15- const { RouterInstrumentation } = require ( '@opentelemetry/instrumentation-router' ) ;
34+ const {
35+ RouterInstrumentation,
36+ } = require ( '@opentelemetry/instrumentation-router' ) ;
1637
17- const Exporter = ( ( exporterParam ) => {
38+ const Exporter = ( exporterParam => {
1839 if ( typeof exporterParam === 'string' ) {
1940 const exporterString = exporterParam . toLowerCase ( ) ;
2041 if ( exporterString . startsWith ( 'z' ) ) {
@@ -27,23 +48,18 @@ const Exporter = ((exporterParam) => {
2748 return ConsoleSpanExporter ;
2849} ) ( process . env . EXPORTER ) ;
2950
30- module . exports = ( serviceName ) => {
51+ module . exports = serviceName => {
3152 const exporter = new Exporter ( {
3253 serviceName,
3354 } ) ;
3455
3556 const provider = new NodeTracerProvider ( {
36- spanProcessors : [
37- new SimpleSpanProcessor ( exporter ) ,
38- ] ,
57+ spanProcessors : [ new SimpleSpanProcessor ( exporter ) ] ,
3958 } ) ;
4059
4160 registerInstrumentations ( {
4261 tracerProvider : provider ,
43- instrumentations : [
44- HttpInstrumentation ,
45- RouterInstrumentation ,
46- ] ,
62+ instrumentations : [ HttpInstrumentation , RouterInstrumentation ] ,
4763 } ) ;
4864
4965 // Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings
0 commit comments