Repository: incubator-htrace Updated Branches: refs/heads/master 07d428de3 -> 405105475
HTRACE-176. Expose ZipkinSpanReceiver configuration keys externally (Daniel Lee via iwasakims) Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/40510547 Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/40510547 Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/40510547 Branch: refs/heads/master Commit: 40510547528e123a20000f6e21164093e5da24a9 Parents: 07d428d Author: Masatake Iwasaki <[email protected]> Authored: Wed Jun 3 12:53:04 2015 +0900 Committer: Masatake Iwasaki <[email protected]> Committed: Wed Jun 3 12:53:04 2015 +0900 ---------------------------------------------------------------------- .../org/apache/htrace/impl/ZipkinSpanReceiver.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/40510547/htrace-zipkin/src/main/java/org/apache/htrace/impl/ZipkinSpanReceiver.java ---------------------------------------------------------------------- diff --git a/htrace-zipkin/src/main/java/org/apache/htrace/impl/ZipkinSpanReceiver.java b/htrace-zipkin/src/main/java/org/apache/htrace/impl/ZipkinSpanReceiver.java index d75c504..f39b753 100644 --- a/htrace-zipkin/src/main/java/org/apache/htrace/impl/ZipkinSpanReceiver.java +++ b/htrace-zipkin/src/main/java/org/apache/htrace/impl/ZipkinSpanReceiver.java @@ -66,11 +66,19 @@ public class ZipkinSpanReceiver implements SpanReceiver { * Default hostname to fall back on. */ private static final String DEFAULT_COLLECTOR_HOSTNAME = "localhost"; + public static final String HOSTNAME_KEY = "zipkin.collector-hostname"; /** * Default collector port. */ private static final int DEFAULT_COLLECTOR_PORT = 9410; // trace collector default port. + public static final String PORT_KEY = "zipkin.collector-port"; + + /** + * Default number of threads to use. + */ + private static final int DEFAULT_NUM_THREAD = 1; + public static final String NUM_THREAD_KEY = "zipkin.num-threads"; /** * this is used to tell scribe that the entries are for zipkin.. @@ -153,15 +161,13 @@ public class ZipkinSpanReceiver implements SpanReceiver { private void configure(HTraceConfiguration conf) { this.conf = conf; - this.collectorHostname = conf.get("zipkin.collector-hostname", - DEFAULT_COLLECTOR_HOSTNAME); - this.collectorPort = conf.getInt("zipkin.collector-port", - DEFAULT_COLLECTOR_PORT); + this.collectorHostname = conf.get(HOSTNAME_KEY, DEFAULT_COLLECTOR_HOSTNAME); + this.collectorPort = conf.getInt(PORT_KEY, DEFAULT_COLLECTOR_PORT); // initialize the endpoint. This endpoint is used while writing the Span. initConverter(); - int numThreads = conf.getInt("zipkin.num-threads", 1); + int numThreads = conf.getInt(NUM_THREAD_KEY, DEFAULT_NUM_THREAD); // If there are already threads runnnig tear them down. if (this.service != null) {
