diff --git a/examples/http/server.js b/examples/http/server.js index d7a90310fb3..604f688f840 100644 --- a/examples/http/server.js +++ b/examples/http/server.js @@ -29,21 +29,17 @@ function handleRequest(request, response) { }); // Annotate our span to capture metadata about the operation span.addEvent('invoking handleRequest'); - try { - const body = []; - request.on('error', (err) => console.log(err)); - request.on('data', (chunk) => body.push(chunk)); - request.on('end', () => { - // deliberately sleeping to mock some action. - setTimeout(() => { - span.end(); - response.end('Hello World!'); - }, 2000); - }); - } catch (err) { - console.error(err); - span.end(); - } + + const body = []; + request.on('error', (err) => console.log(err)); + request.on('data', (chunk) => body.push(chunk)); + request.on('end', () => { + // deliberately sleeping to mock some action. + setTimeout(() => { + span.end(); + response.end('Hello World!'); + }, 2000); + }); } startServer(8080); diff --git a/examples/https/server.js b/examples/https/server.js index a3d480f5686..d4a23573684 100644 --- a/examples/https/server.js +++ b/examples/https/server.js @@ -34,21 +34,17 @@ function handleRequest(request, response) { }); // Annotate our span to capture metadata about the operation span.addEvent('invoking handleRequest'); - try { - const body = []; - request.on('error', (err) => console.log(err)); - request.on('data', (chunk) => body.push(chunk)); - request.on('end', () => { - // deliberately sleeping to mock some action. - setTimeout(() => { - span.end(); - response.end('Hello World!'); - }, 2000); - }); - } catch (err) { - console.log(err); - span.end(); - } + + const body = []; + request.on('error', (err) => console.log(err)); + request.on('data', (chunk) => body.push(chunk)); + request.on('end', () => { + // deliberately sleeping to mock some action. + setTimeout(() => { + span.end(); + response.end('Hello World!'); + }, 2000); + }); } startServer(443); diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts index 7d0de201c04..9cbf3642763 100644 --- a/packages/opentelemetry-core/src/index.ts +++ b/packages/opentelemetry-core/src/index.ts @@ -30,6 +30,7 @@ export * from './trace/sampler/AlwaysOnSampler'; export * from './trace/sampler/ParentBasedSampler'; export * from './trace/sampler/TraceIdRatioBasedSampler'; export * from './trace/TraceState'; +export * from './utils/environment'; export * from './utils/sampling'; export * from './utils/url'; export * from './utils/wrap'; diff --git a/packages/opentelemetry-tracing/src/config.ts b/packages/opentelemetry-tracing/src/config.ts index 4e770eb5fae..2db3db8adcb 100644 --- a/packages/opentelemetry-tracing/src/config.ts +++ b/packages/opentelemetry-tracing/src/config.ts @@ -21,9 +21,9 @@ import { getEnv, TracesSamplerValues, ParentBasedSampler, + ENVIRONMENT, TraceIdRatioBasedSampler, } from '@opentelemetry/core'; -import { ENVIRONMENT } from '@opentelemetry/core/src/utils/environment'; const env = getEnv(); const FALLBACK_OTEL_TRACES_SAMPLER = TracesSamplerValues.AlwaysOn;