From 68cfb4fc42fc6a3f2a9ce40d471acc0486e3e0ec Mon Sep 17 00:00:00 2001 From: djshen-ponddy Date: Wed, 26 Jul 2017 17:30:42 +0800 Subject: [PATCH] Allow to set custom hostname for jaeger agent. From https://github.com/uber/jaeger-client-python/pull/51 --- jaeger_client/config.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jaeger_client/config.py b/jaeger_client/config.py index 3f2cf53a..a48cb2a7 100644 --- a/jaeger_client/config.py +++ b/jaeger_client/config.py @@ -50,6 +50,7 @@ from .metrics import Metrics from .utils import get_boolean, ErrorReporter +DEFAULT_REPORTING_HOST = 'localhost' DEFAULT_REPORTING_PORT = 5775 DEFAULT_SAMPLING_PORT = 5778 LOCAL_AGENT_DEFAULT_ENABLED = True @@ -212,6 +213,14 @@ def local_agent_reporting_port(self): except: return DEFAULT_REPORTING_PORT + @property + def local_agent_reporting_host(self): + # noinspection PyBroadException + try: + return self.local_agent_group()['reporting_host'] + except: + return DEFAULT_REPORTING_HOST + @property def max_operations(self): return self.config.get('max_operations', None) @@ -293,7 +302,7 @@ def _create_local_agent_channel(self, io_loop): """ logger.info('Initializing Jaeger Tracer with UDP reporter') return LocalAgentSender( - host='localhost', + host=self.local_agent_reporting_host, sampling_port=self.local_agent_sampling_port, reporting_port=self.local_agent_reporting_port, io_loop=io_loop