diff options
author | James E. Blair <jim@acmegating.com> | 2022-08-24 15:33:25 -0700 |
---|---|---|
committer | Simon Westphahl <simon.westphahl@bmw.de> | 2022-09-19 08:42:28 +0200 |
commit | ce40b296776caf8ca76825befa35c4b166488e11 (patch) | |
tree | a7b84ae86e01d162ae8811d38e72cd4cf309396e /tests/base.py | |
parent | af320884dd4327b20df0e59699fed3d3a869f4ee (diff) | |
download | zuul-ce40b296776caf8ca76825befa35c4b166488e11.tar.gz |
Add support for configuring and testing tracing
This adds support for configuring tracing in Zuul along with
basic documentation of the configuration.
It also adds test infrastructure that runs a gRPC-based collector
so that we can test tracing end-to-end, and exercises a simple
test span.
Change-Id: I4744dc2416460a2981f2c90eb3e48ac93ec94964
Diffstat (limited to 'tests/base.py')
-rw-r--r-- | tests/base.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/base.py b/tests/base.py index cebcf2e1f..317d9d175 100644 --- a/tests/base.py +++ b/tests/base.py @@ -125,6 +125,8 @@ from zuul.lib.logutil import get_annotated_logger import tests.fakegithub import tests.fakegitlab +from tests.otlp_fixture import OTLPFixture +import opentelemetry.sdk.trace.export FIXTURE_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') @@ -4911,6 +4913,15 @@ class ZuulTestCase(BaseTestCase): if 'database' in config.sections(): _setup_fixture(config, 'database') + if 'tracing' in config.sections(): + self.otlp = OTLPFixture() + self.useFixture(self.otlp) + self.useFixture(fixtures.MonkeyPatch( + 'zuul.lib.tracing.Tracing.processor_class', + opentelemetry.sdk.trace.export.SimpleSpanProcessor)) + config.set('tracing', 'endpoint', + f'http://localhost:{self.otlp.port}') + if not self.setupSimpleLayout(config): tenant_config = None for cfg_attr in ('tenant_config', 'tenant_config_script'): @@ -5197,6 +5208,7 @@ class ZuulTestCase(BaseTestCase): and not t.name.startswith('Dummy-') and not t.name.startswith('pydevd.') and not t.name.startswith('ptvsd.') + and not t.name.startswith('OTLPFixture_') ] if len(threads) > 1: thread_map = dict(map(lambda x: (x.ident, x.name), |