Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Merge c40de22 into 0e05450
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Courreges authored Jan 24, 2020
2 parents 0e05450 + c40de22 commit 9dbc84b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ JAEGER_REPORTER_LOG_SPANS | Whether the reporter should also log the spans
JAEGER_REPORTER_MAX_QUEUE_SIZE | The reporter's maximum queue size
JAEGER_REPORTER_FLUSH_INTERVAL | The reporter's flush interval (ms)
JAEGER_SAMPLER_TYPE | The [sampler type](https://www.jaegertracing.io/docs/latest/sampling/#client-sampling-configuration)
JAEGER_SAMPLER_PARAM | The sampler parameter (number)
JAEGER_SAMPLER_MANAGER_HOST_PORT | The host name and port when using the remote controlled sampler
JAEGER_SAMPLER_PARAM | The sampler parameter (double)
JAEGER_SAMPLER_SERVER_URL | The url for the remote conf when using sampler type remote. Default is http://127.0.0.1:5778/sampling
JAEGER_TAGS | A comma separated list of `name = value` tracer level tags, which get added to all reported spans. The value can also refer to an environment variable using the format `${envVarName:default}`, where the `:default` is optional, and identifies a value to be used if the environment variable cannot be found

## License
Expand Down
10 changes: 6 additions & 4 deletions src/jaegertracing/ConfigTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ TEST(Config, testFromEnv)
setEnv("JAEGER_REPORTER_FLUSH_INTERVAL", "45");
setEnv("JAEGER_REPORTER_LOG_SPANS", "true");

setEnv("JAEGER_SAMPLER_PARAM", "33");
setEnv("JAEGER_SAMPLER_TYPE", "const");
setEnv("JAEGER_SAMPLER_TYPE", "remote");
setEnv("JAEGER_SAMPLER_PARAM", "0.33");
setEnv("JAEGER_SAMPLER_SERVER_URL", "http://myagent:1234");

setEnv("JAEGER_SERVICE_NAME", "AService");
setEnv("JAEGER_TAGS", "hostname=foobar,my.app.version=4.5.6");
Expand All @@ -163,8 +164,9 @@ TEST(Config, testFromEnv)
config.reporter().bufferFlushInterval());
ASSERT_EQ(true, config.reporter().logSpans());

ASSERT_EQ(33., config.sampler().param());
ASSERT_EQ(std::string("const"), config.sampler().type());
ASSERT_EQ(std::string("remote"), config.sampler().type());
ASSERT_EQ(0.33, config.sampler().param());
ASSERT_EQ(std::string("http://myagent:1234"), config.sampler().samplingServerURL());

ASSERT_EQ(std::string("AService"), config.serviceName());

Expand Down
6 changes: 5 additions & 1 deletion src/jaegertracing/samplers/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ void Config::fromEnv()
const auto param = utils::EnvVariable::getStringVariable(kJAEGER_SAMPLER_PARAM_ENV_PROP);
if (!param.empty()) {
std::istringstream iss(param);
int paramVal = 0;
double paramVal = 0;
if (iss >> paramVal) {
_param = paramVal;
}
}
const auto samplingServerURL = utils::EnvVariable::getStringVariable(kJAEGER_SAMPLER_SERVER_URL_ENV_PROP);
if (!samplingServerURL.empty()) {
_samplingServerURL = samplingServerURL;
}
}

} // namespace samplers
Expand Down
2 changes: 1 addition & 1 deletion src/jaegertracing/samplers/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Config {

static constexpr auto kJAEGER_SAMPLER_TYPE_ENV_PROP = "JAEGER_SAMPLER_TYPE";
static constexpr auto kJAEGER_SAMPLER_PARAM_ENV_PROP = "JAEGER_SAMPLER_PARAM";
static constexpr auto kJAEGER_SAMPLER_MANAGER_HOST_PORT_ENV_PROP = "JAEGER_SAMPLER_MANAGER_HOST_PORT";
static constexpr auto kJAEGER_SAMPLER_SERVER_URL_ENV_PROP = "JAEGER_SAMPLER_SERVER_URL";

static Clock::duration defaultSamplingRefreshInterval()
{
Expand Down

0 comments on commit 9dbc84b

Please # to comment.