From 394275902a3fb077d482fe6f920db9deb27f3fa5 Mon Sep 17 00:00:00 2001 From: leonardo dalcin Date: Mon, 13 Apr 2020 14:34:07 -0300 Subject: [PATCH 01/11] feat(opentelemetry-exporter-jaeger): http sender --- packages/opentelemetry-exporter-jaeger/src/jaeger.ts | 12 +++++++++++- packages/opentelemetry-exporter-jaeger/src/types.ts | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 83f6658492..5cc5178289 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -38,7 +38,17 @@ export class JaegerExporter implements SpanExporter { typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000; config.host = config.host || process.env.JAEGER_AGENT_HOST; - + config.endpoint = config.endpoint || process.env.JAEGER_ENDPOINT; + config.username = config.username || process.env.JAEGER_USER; + config.password = config.password || process.env.JAEGER_PASSWORD; + // https://github.com/jaegertracing/jaeger-client-node#environment-variables + // By default, the client sends traces via UDP to the agent at localhost:6832. Use JAEGER_AGENT_HOST and + // JAEGER_AGENT_PORT to send UDP traces to a different host:port. If JAEGER_ENDPOINT is set, the client sends traces + // to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured, + // HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables. + this._sender = config.endpoint + ? new jaegerTypes.HTTPSender(config) + : new jaegerTypes.UDPSender(config); this._sender = new jaegerTypes.UDPSender(config); if (this._sender._client instanceof Socket) { // unref socket to prevent it from keeping the process running diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts index c902cfd309..72282212d2 100644 --- a/packages/opentelemetry-exporter-jaeger/src/types.ts +++ b/packages/opentelemetry-exporter-jaeger/src/types.ts @@ -28,6 +28,13 @@ export interface ExporterConfig { maxPacketSize?: number; // default: 65000 /** Time to wait for an onShutdown flush to finish before closing the sender */ flushTimeout?: number; // default: 2000 + //The HTTP endpoint for sending spans directly to a collector, i.e. http://jaeger-collector:14268/api/traces + //If setten will override host and port + endpoint?: string; + //Username to send as part of "Basic" authentication to the collector endpoint + username?: string; + //Password to send as part of "Basic" authentication to the collector endpoint + password?: string; } // Below require is needed as jaeger-client types does not expose the thrift, @@ -41,6 +48,8 @@ export const Utils = require('jaeger-client/dist/src/util').default; // tslint:disable-next-line:variable-name export const ThriftUtils = require('jaeger-client/dist/src/thrift').default; +export const HTTPSender = require('jaeger-client/dist/src/reporters/http_sender').default; + export type TagValue = string | number | boolean; export interface Tag { From 0408488905767f267009a62de00a4068a754b0cd Mon Sep 17 00:00:00 2001 From: Leonardo Dalcin Date: Mon, 13 Apr 2020 15:25:47 -0300 Subject: [PATCH 02/11] fix: linter --- packages/opentelemetry-exporter-jaeger/src/types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts index 72282212d2..31c9bc82f0 100644 --- a/packages/opentelemetry-exporter-jaeger/src/types.ts +++ b/packages/opentelemetry-exporter-jaeger/src/types.ts @@ -48,7 +48,8 @@ export const Utils = require('jaeger-client/dist/src/util').default; // tslint:disable-next-line:variable-name export const ThriftUtils = require('jaeger-client/dist/src/thrift').default; -export const HTTPSender = require('jaeger-client/dist/src/reporters/http_sender').default; +export const HTTPSender = require('jaeger-client/dist/src/reporters/http_sender') + .default; export type TagValue = string | number | boolean; From 256eb0e910a12abb3232043e500def4e38c41b35 Mon Sep 17 00:00:00 2001 From: leonardodalcin Date: Fri, 17 Apr 2020 09:53:11 -0300 Subject: [PATCH 03/11] fix(opentelemetry-exporter-jaeger): adds header to avoid infinity loop --- .../opentelemetry-exporter-jaeger/src/jaeger.ts | 12 ++++++++---- .../opentelemetry-exporter-jaeger/src/utils.ts | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 packages/opentelemetry-exporter-jaeger/src/utils.ts diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 5cc5178289..33dd5c2ad0 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -21,6 +21,7 @@ import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; import { Socket } from 'dgram'; import { spanToThrift } from './transform'; import * as jaegerTypes from './types'; +import { OT_REQUEST_HEADER } from './utils'; /** * Format and sends span information to Jaeger Exporter. @@ -46,10 +47,13 @@ export class JaegerExporter implements SpanExporter { // JAEGER_AGENT_PORT to send UDP traces to a different host:port. If JAEGER_ENDPOINT is set, the client sends traces // to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured, // HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables. - this._sender = config.endpoint - ? new jaegerTypes.HTTPSender(config) - : new jaegerTypes.UDPSender(config); - this._sender = new jaegerTypes.UDPSender(config); + if (config.endpoint) { + this._sender = new jaegerTypes.HTTPSender(config); + this._sender._httpOptions.headers[OT_REQUEST_HEADER] = 1; + } else { + this._sender = config.endpoint = new jaegerTypes.UDPSender(config); + } + if (this._sender._client instanceof Socket) { // unref socket to prevent it from keeping the process running this._sender._client.unref(); diff --git a/packages/opentelemetry-exporter-jaeger/src/utils.ts b/packages/opentelemetry-exporter-jaeger/src/utils.ts new file mode 100644 index 0000000000..6e61f4e7bb --- /dev/null +++ b/packages/opentelemetry-exporter-jaeger/src/utils.ts @@ -0,0 +1,17 @@ +/*! + * Copyright 2020, OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const OT_REQUEST_HEADER = 'x-opentelemetry-outgoing-request'; From 2ef75b5833d873f9230aaede5d3c26612ac52873 Mon Sep 17 00:00:00 2001 From: leonardodalcin Date: Fri, 17 Apr 2020 10:02:30 -0300 Subject: [PATCH 04/11] test(opentelemetry-exporter-jaeger): verify http sender usage --- .../test/jaeger.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index 53105fd3ce..6e7f3bfd25 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -23,6 +23,7 @@ import { ReadableSpan } from '@opentelemetry/tracing'; import { ExportResult } from '@opentelemetry/base'; import { TraceFlags } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; +import { OT_REQUEST_HEADER } from '../src/utils'; describe('JaegerExporter', () => { describe('constructor', () => { @@ -150,5 +151,17 @@ describe('JaegerExporter', () => { assert.strictEqual(result, ExportResult.SUCCESS); }); }); + + it('should use httpSender if config.endpoint is setten and set x-opentelemetry-outgoing-request header', () => { + const exporter = new JaegerExporter({ + serviceName: 'opentelemetry', + endpoint: 'http://testendpoint', + }); + assert.strictEqual(exporter['_sender'].constructor.name, 'HTTPSender'); + assert.strictEqual( + exporter['_sender']._httpOptions.headers[OT_REQUEST_HEADER], + 1 + ); + }); }); }); From 7e645661f87936eddc582109bb3ff7b6d9a76fca Mon Sep 17 00:00:00 2001 From: leonardo dalcin Date: Mon, 20 Apr 2020 12:53:25 -0300 Subject: [PATCH 05/11] refactor(opentelemetry-exporter-jaeger): checks if endpoint is setten --- packages/opentelemetry-exporter-jaeger/src/jaeger.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 33dd5c2ad0..acca9faa01 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -38,19 +38,19 @@ export class JaegerExporter implements SpanExporter { this._onShutdownFlushTimeout = typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000; - config.host = config.host || process.env.JAEGER_AGENT_HOST; - config.endpoint = config.endpoint || process.env.JAEGER_ENDPOINT; - config.username = config.username || process.env.JAEGER_USER; - config.password = config.password || process.env.JAEGER_PASSWORD; // https://github.com/jaegertracing/jaeger-client-node#environment-variables // By default, the client sends traces via UDP to the agent at localhost:6832. Use JAEGER_AGENT_HOST and // JAEGER_AGENT_PORT to send UDP traces to a different host:port. If JAEGER_ENDPOINT is set, the client sends traces // to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured, // HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables. if (config.endpoint) { + config.endpoint = config.endpoint || process.env.JAEGER_ENDPOINT; + config.username = config.username || process.env.JAEGER_USER; + config.password = config.password || process.env.JAEGER_PASSWORD; this._sender = new jaegerTypes.HTTPSender(config); this._sender._httpOptions.headers[OT_REQUEST_HEADER] = 1; } else { + config.host = config.host || process.env.JAEGER_AGENT_HOST; this._sender = config.endpoint = new jaegerTypes.UDPSender(config); } From 5620e16609b20bd9e7b7e4be82e5576c41035de8 Mon Sep 17 00:00:00 2001 From: leonardo dalcin Date: Fri, 8 May 2020 16:53:42 -0300 Subject: [PATCH 06/11] feat(opentelemetry-exporter-jaeger): adds nock as dev dependency --- packages/opentelemetry-exporter-jaeger/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 7148a4786b..2cf7d799e1 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -48,6 +48,7 @@ "gts": "^1.1.0", "mocha": "^6.2.0", "nyc": "^15.0.0", + "nock": "^12.0.3", "rimraf": "^3.0.0", "ts-mocha": "^6.0.0", "ts-node": "^8.6.2", From 90f919e28f9fb509c7fe9fc37d4ee3b8ee9d3ceb Mon Sep 17 00:00:00 2001 From: leonardo dalcin Date: Fri, 8 May 2020 16:54:11 -0300 Subject: [PATCH 07/11] test(opentelemetry-exporter-jaeger): adds tests to check req header --- .../test/jaeger.test.ts | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index 6e7f3bfd25..9c81c82dc6 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -24,6 +24,7 @@ import { ExportResult } from '@opentelemetry/base'; import { TraceFlags } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import { OT_REQUEST_HEADER } from '../src/utils'; +import * as nock from 'nock'; describe('JaegerExporter', () => { describe('constructor', () => { @@ -152,16 +153,50 @@ describe('JaegerExporter', () => { }); }); - it('should use httpSender if config.endpoint is setten and set x-opentelemetry-outgoing-request header', () => { + it('should use httpSender if config.endpoint is setten and set x-opentelemetry-outgoing-request header', done => { + const mockedEndpoint = 'http://testendpoint'; + nock(mockedEndpoint) + .post('/') + .reply(function() { + assert.strictEqual(this.req.headers[OT_REQUEST_HEADER], 1); + assert.strictEqual( + this.req.headers['content-type'], + 'application/x-thrift' + ); + assert.strictEqual(this.req.headers.host, 'testendpoint'); + done(); + }); const exporter = new JaegerExporter({ serviceName: 'opentelemetry', - endpoint: 'http://testendpoint', + endpoint: mockedEndpoint, }); assert.strictEqual(exporter['_sender'].constructor.name, 'HTTPSender'); assert.strictEqual( exporter['_sender']._httpOptions.headers[OT_REQUEST_HEADER], 1 ); + const spanContext = { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; + const readableSpan: ReadableSpan = { + name: 'my-span1', + kind: types.SpanKind.CLIENT, + spanContext, + startTime: [1566156729, 709], + endTime: [1566156731, 709], + ended: true, + status: { + code: types.CanonicalCode.DATA_LOSS, + }, + attributes: {}, + links: [], + events: [], + duration: [32, 800000000], + resource: Resource.empty(), + }; + exporter.export([readableSpan], () => {}); }); }); }); From 38dc8509b8a1268228b4bc5c100923f8db054f69 Mon Sep 17 00:00:00 2001 From: leonardo dalcin Date: Fri, 8 May 2020 17:08:59 -0300 Subject: [PATCH 08/11] fix: tests variable usage --- packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index 4ce9f5c748..12aee250e1 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -181,13 +181,13 @@ describe('JaegerExporter', () => { }; const readableSpan: ReadableSpan = { name: 'my-span1', - kind: types.SpanKind.CLIENT, + kind: api.SpanKind.CLIENT, spanContext, startTime: [1566156729, 709], endTime: [1566156731, 709], ended: true, status: { - code: types.CanonicalCode.DATA_LOSS, + code: api.CanonicalCode.DATA_LOSS, }, attributes: {}, links: [], From 2c757923142e778ca2212c8548a50105adb6ca40 Mon Sep 17 00:00:00 2001 From: leonardo dalcin Date: Wed, 3 Jun 2020 13:49:40 -0300 Subject: [PATCH 09/11] refactor(opentelemetry-exporter-jaeger): removes config parameter change --- .../src/jaeger.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index c64d4ba118..11e135eb76 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -32,25 +32,26 @@ export class JaegerExporter implements SpanExporter { private readonly _onShutdownFlushTimeout: number; constructor(config: jaegerTypes.ExporterConfig) { - this._logger = config.logger || new NoopLogger(); - const tags: jaegerTypes.Tag[] = config.tags || []; + const localConfig = Object.assign({}, config) + this._logger = localConfig.logger || new NoopLogger(); + const tags: jaegerTypes.Tag[] = localConfig.tags || []; this._onShutdownFlushTimeout = - typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000; + typeof localConfig.flushTimeout === 'number' ? localConfig.flushTimeout : 2000; // https://github.com/jaegertracing/jaeger-client-node#environment-variables // By default, the client sends traces via UDP to the agent at localhost:6832. Use JAEGER_AGENT_HOST and // JAEGER_AGENT_PORT to send UDP traces to a different host:port. If JAEGER_ENDPOINT is set, the client sends traces // to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured, // HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables. - if (config.endpoint) { - config.endpoint = config.endpoint || process.env.JAEGER_ENDPOINT; - config.username = config.username || process.env.JAEGER_USER; - config.password = config.password || process.env.JAEGER_PASSWORD; - this._sender = new jaegerTypes.HTTPSender(config); + if (localConfig.endpoint) { + localConfig.endpoint = localConfig.endpoint || process.env.JAEGER_ENDPOINT; + localConfig.username = localConfig.username || process.env.JAEGER_USER; + localConfig.password = localConfig.password || process.env.JAEGER_PASSWORD; + this._sender = new jaegerTypes.HTTPSender(localConfig); this._sender._httpOptions.headers[OT_REQUEST_HEADER] = 1; } else { - config.host = config.host || process.env.JAEGER_AGENT_HOST; - this._sender = config.endpoint = new jaegerTypes.UDPSender(config); + localConfig.host = localConfig.host || process.env.JAEGER_AGENT_HOST; + this._sender = localConfig.endpoint = new jaegerTypes.UDPSender(localConfig); } if (this._sender._client instanceof Socket) { @@ -59,7 +60,7 @@ export class JaegerExporter implements SpanExporter { } this._process = { - serviceName: config.serviceName, + serviceName: localConfig.serviceName, tags: jaegerTypes.ThriftUtils.getThriftTags(tags), }; this._sender.setProcess(this._process); From d2843876df9bc7c1d7935a6f443a64af5901eadf Mon Sep 17 00:00:00 2001 From: Leonardo Dalcin Date: Wed, 3 Jun 2020 14:02:49 -0300 Subject: [PATCH 10/11] fix: linter --- .../opentelemetry-exporter-jaeger/src/jaeger.ts | 16 +++++++++++----- .../test/jaeger.test.ts | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 11e135eb76..61be1619a5 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -32,11 +32,13 @@ export class JaegerExporter implements SpanExporter { private readonly _onShutdownFlushTimeout: number; constructor(config: jaegerTypes.ExporterConfig) { - const localConfig = Object.assign({}, config) + const localConfig = Object.assign({}, config); this._logger = localConfig.logger || new NoopLogger(); const tags: jaegerTypes.Tag[] = localConfig.tags || []; this._onShutdownFlushTimeout = - typeof localConfig.flushTimeout === 'number' ? localConfig.flushTimeout : 2000; + typeof localConfig.flushTimeout === 'number' + ? localConfig.flushTimeout + : 2000; // https://github.com/jaegertracing/jaeger-client-node#environment-variables // By default, the client sends traces via UDP to the agent at localhost:6832. Use JAEGER_AGENT_HOST and @@ -44,14 +46,18 @@ export class JaegerExporter implements SpanExporter { // to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured, // HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables. if (localConfig.endpoint) { - localConfig.endpoint = localConfig.endpoint || process.env.JAEGER_ENDPOINT; + localConfig.endpoint = + localConfig.endpoint || process.env.JAEGER_ENDPOINT; localConfig.username = localConfig.username || process.env.JAEGER_USER; - localConfig.password = localConfig.password || process.env.JAEGER_PASSWORD; + localConfig.password = + localConfig.password || process.env.JAEGER_PASSWORD; this._sender = new jaegerTypes.HTTPSender(localConfig); this._sender._httpOptions.headers[OT_REQUEST_HEADER] = 1; } else { localConfig.host = localConfig.host || process.env.JAEGER_AGENT_HOST; - this._sender = localConfig.endpoint = new jaegerTypes.UDPSender(localConfig); + this._sender = localConfig.endpoint = new jaegerTypes.UDPSender( + localConfig + ); } if (this._sender._client instanceof Socket) { diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index 12aee250e1..926baabdea 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -156,7 +156,7 @@ describe('JaegerExporter', () => { const mockedEndpoint = 'http://testendpoint'; nock(mockedEndpoint) .post('/') - .reply(function() { + .reply(function () { assert.strictEqual(this.req.headers[OT_REQUEST_HEADER], 1); assert.strictEqual( this.req.headers['content-type'], From 8d518008f724071807a26ab3ce6cfe0a7ce2cf4f Mon Sep 17 00:00:00 2001 From: Leonardo Dalcin Date: Wed, 3 Jun 2020 14:06:06 -0300 Subject: [PATCH 11/11] fix: env var was never called --- packages/opentelemetry-exporter-jaeger/src/jaeger.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 61be1619a5..a08996ac1d 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -45,16 +45,14 @@ export class JaegerExporter implements SpanExporter { // JAEGER_AGENT_PORT to send UDP traces to a different host:port. If JAEGER_ENDPOINT is set, the client sends traces // to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured, // HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables. + localConfig.endpoint = localConfig.endpoint || process.env.JAEGER_ENDPOINT; + localConfig.username = localConfig.username || process.env.JAEGER_USER; + localConfig.password = localConfig.password || process.env.JAEGER_PASSWORD; + localConfig.host = localConfig.host || process.env.JAEGER_AGENT_HOST; if (localConfig.endpoint) { - localConfig.endpoint = - localConfig.endpoint || process.env.JAEGER_ENDPOINT; - localConfig.username = localConfig.username || process.env.JAEGER_USER; - localConfig.password = - localConfig.password || process.env.JAEGER_PASSWORD; this._sender = new jaegerTypes.HTTPSender(localConfig); this._sender._httpOptions.headers[OT_REQUEST_HEADER] = 1; } else { - localConfig.host = localConfig.host || process.env.JAEGER_AGENT_HOST; this._sender = localConfig.endpoint = new jaegerTypes.UDPSender( localConfig );