Skip to content

Commit

Permalink
Add new configuration properties for host and port (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
backjo authored and geoand committed Jun 27, 2019
1 parent cf46565 commit 487799b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,14 @@ public Sampler sampler(JaegerConfigurationProperties properties, Metrics metrics
JaegerConfigurationProperties.RemoteControlledSampler samplerProperties
= properties.getRemoteControlledSampler();

String hostPort = samplerProperties.getHostPort();

if (samplerProperties.getHost() != null && !samplerProperties.getHost().isEmpty()) {
hostPort = samplerProperties.getHost() + ":" + samplerProperties.getPort();
}

return new RemoteControlledSampler.Builder(properties.getServiceName())
.withSamplingManager(new HttpSamplingManager(samplerProperties.getHostPort()))
.withSamplingManager(new HttpSamplingManager(hostPort))
.withInitialSampler(
new ProbabilisticSampler(samplerProperties.getSamplingRate()))
.withMetrics(metrics)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;

@ConfigurationProperties("opentracing.jaeger")
public class JaegerConfigurationProperties {
Expand Down Expand Up @@ -341,10 +342,15 @@ public static class RemoteControlledSampler {
*/
private String hostPort;

private String host;

private int port = 5778;

private Double samplingRate =
io.jaegertracing.internal.samplers.ProbabilisticSampler.DEFAULT_SAMPLING_PROBABILITY;


@DeprecatedConfigurationProperty(replacement = "Use host + port properties instead")
public String getHostPort() {
return hostPort;
}
Expand All @@ -353,6 +359,22 @@ public void setHostPort(String hostPort) {
this.hostPort = hostPort;
}

public int getPort() {
return port;
}

public void setPort(int port) {
this.port = port;
}

public String getHost() {
return host;
}

public void setHost(String host) {
this.host = host;
}

public Double getSamplingRate() {
return samplingRate;
}
Expand Down

0 comments on commit 487799b

Please sign in to comment.