diff --git a/src/configuration.js b/src/configuration.js index 93be1b4c8..2f0806c03 100644 --- a/src/configuration.js +++ b/src/configuration.js @@ -39,6 +39,7 @@ let jaegerSchema = { hostPort: { type: 'string' }, host: { type: 'string' }, port: { type: 'number' }, + samplingPath: { type: 'string' }, refreshIntervalMs: { type: 'number' }, }, required: ['type', 'param'], @@ -76,6 +77,7 @@ export default class Configuration { let hostPort = config.sampler.hostPort; let host = config.sampler.host; let port = config.sampler.port; + let samplingPath = config.sampler.samplingPath; let refreshIntervalMs = config.sampler.refreshIntervalMs; if (typeof param !== 'number') { @@ -101,6 +103,7 @@ export default class Configuration { hostPort: hostPort, host: host, port: port, + samplingPath: samplingPath, refreshInterval: refreshIntervalMs, metrics: options.metrics, logger: options.logger, @@ -138,7 +141,7 @@ export default class Configuration { senderConfig['password'] = config.reporter.password; } if (config.reporter.timeoutMs) { - senderConfig[ 'timeoutMs' ] = config.reporter.timeoutMs; + senderConfig['timeoutMs'] = config.reporter.timeoutMs; } } if (config.reporter.agentHost) { diff --git a/src/configuration_env.js b/src/configuration_env.js index a437c713c..7f6690b56 100644 --- a/src/configuration_env.js +++ b/src/configuration_env.js @@ -72,6 +72,15 @@ export default class ConfigurationEnv { samplerConfig.port = parseInt(value); } + value = ConfigurationEnv._getConfigValue( + config.sampler, + 'samplingPath', + process.env.JAEGER_SAMPLER_SAMPLING_PATH + ); + if (value) { + samplerConfig.samplingPath = value; + } + value = ConfigurationEnv._getConfigValue( config.sampler, 'refreshIntervalMs', diff --git a/test/init_tracer.js b/test/init_tracer.js index b652dd061..3eb3a3017 100644 --- a/test/init_tracer.js +++ b/test/init_tracer.js @@ -313,6 +313,7 @@ describe('initTracerFromENV', () => { delete process.env.JAEGER_SAMPLER_HOST; delete process.env.JAEGER_SAMPLER_PORT; delete process.env.JAEGER_SAMPLER_MANAGER_HOST_PORT; + delete process.env.JAEGER_SAMPLER_SAMPLING_PATH; delete process.env.JAEGER_SAMPLER_REFRESH_INTERVAL; delete process.env.JAEGER_REPORTER_AGENT_PORT; delete process.env.JAEGER_AGENT_PORT; @@ -397,11 +398,13 @@ describe('initTracerFromENV', () => { process.env.JAEGER_SAMPLER_TYPE = 'remote'; process.env.JAEGER_SAMPLER_MANAGER_HOST_PORT = 'localhost:8080'; + process.env.JAEGER_SAMPLER_SAMPLING_PATH = '/api/sampling'; process.env.JAEGER_SAMPLER_REFRESH_INTERVAL = 100; tracer = initTracerFromEnv(); expect(tracer._sampler).to.be.an.instanceof(RemoteSampler); assert.equal(tracer._sampler._host, 'localhost'); assert.equal(tracer._sampler._port, 8080); + assert.equal(tracer._sampler._samplingPath, '/api/sampling'); assert.equal(tracer._sampler._refreshInterval, 100); tracer.close(); }); @@ -419,11 +422,13 @@ describe('initTracerFromENV', () => { process.env.JAEGER_SAMPLER_TYPE = 'remote'; process.env.JAEGER_SAMPLER_HOST = 'localhost'; process.env.JAEGER_SAMPLER_PORT = 8080; + process.env.JAEGER_SAMPLER_SAMPLING_PATH = '/api/sampling'; process.env.JAEGER_SAMPLER_REFRESH_INTERVAL = 100; tracer = initTracerFromEnv(); expect(tracer._sampler).to.be.an.instanceof(RemoteSampler); assert.equal(tracer._sampler._host, 'localhost'); assert.equal(tracer._sampler._port, 8080); + assert.equal(tracer._sampler._samplingPath, '/api/sampling'); assert.equal(tracer._sampler._refreshInterval, 100); tracer.close(); });