milvus/shards/tracer/plugins/jaeger_factory.py

38 lines
1.3 KiB
Python
Raw Normal View History

2019-10-25 12:24:03 +00:00
import logging
from jaeger_client import Config
from grpc_opentracing.grpcext import intercept_server
from grpc_opentracing import open_tracing_server_interceptor
from tracer import Tracer
logger = logging.getLogger(__name__)
PLUGIN_NAME = __file__
2019-10-25 12:24:03 +00:00
2019-10-25 12:39:44 +00:00
2019-10-25 12:24:03 +00:00
class JaegerFactory:
name = 'jaeger'
@classmethod
2019-10-26 09:19:57 +00:00
def Create(cls, plugin_config, **kwargs):
tracing_config = plugin_config.TRACING_CONFIG
span_decorator = kwargs.pop('span_decorator', None)
service_name = plugin_config.TRACING_SERVICE_NAME
validate = plugin_config.TRACING_VALIDATE
2019-10-25 12:24:03 +00:00
config = Config(config=tracing_config,
service_name=service_name,
validate=validate)
tracer = config.initialize_tracer()
tracer_interceptor = open_tracing_server_interceptor(
tracer,
2019-10-26 09:19:57 +00:00
log_payloads=plugin_config.TRACING_LOG_PAYLOAD,
2019-10-25 12:24:03 +00:00
span_decorator=span_decorator)
[skip ci] (shards) Upgrade Mishards for #1569 (#1570) * [skip ci](shards): export MAX_WORKERS as configurable parameter Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): skip mishards .env git info Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): support more robust static discovery host configuration Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): update static provider that terminate server if connection to downstream server error during startup Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add topology.py Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add connection pool Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add topology test Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): refactory using topo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): refactory static discovery using topo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): refactory kubernetes discovery using topo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add more test for connection pool Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): export 19541 and 19542 for all_in_one demo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): check version on new connection Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): mock connections Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): update tests Signed-off-by: peng.xu <peng.xu@zilliz.com>
2020-03-14 05:30:21 +00:00
jaeger_logger = logging.getLogger('jaeger_tracing')
jaeger_logger.setLevel(logging.ERROR)
2019-10-25 12:24:03 +00:00
return Tracer(tracer, tracer_interceptor, intercept_server)
def setup(app):
logger.info('Plugin \'{}\' Installed In Package: {}'.format(PLUGIN_NAME, app.plugin_package_name))
2019-10-25 12:24:03 +00:00
app.on_plugin_setup(JaegerFactory)