From 69413722c46f2bcf30028b1f7641c10d1e14089c Mon Sep 17 00:00:00 2001 From: Harsh Modi Date: Wed, 30 Aug 2023 14:43:44 -0400 Subject: [PATCH] get and pass `traceparent` to osbs tasks This is to enable OpenTelemetry tracing in `osbs` Signed-off-by: Harsh Modi --- .../plugins/builder_containerbuild.py | 19 +++++++++++++++++-- test.sh | 4 ++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/koji_containerbuild/plugins/builder_containerbuild.py b/koji_containerbuild/plugins/builder_containerbuild.py index 299bbe8..0d58846 100644 --- a/koji_containerbuild/plugins/builder_containerbuild.py +++ b/koji_containerbuild/plugins/builder_containerbuild.py @@ -316,9 +316,10 @@ def osbs(self): conf_section = DEFAULT_CONF_BINARY_SECTION elif self.method in BuildSourceContainerTask.Methods: conf_section = DEFAULT_CONF_SOURCE_SECTION - os_conf = Configuration(conf_section=conf_section) - self._osbs = OSBS(os_conf) + # figure out where to get this from brew otel + traceparent = '' + self._osbs = OSBS(os_conf, traceparent=traceparent) if not self._osbs: msg = 'Could not successfully instantiate `osbs`' raise ContainerError(msg) @@ -1011,6 +1012,13 @@ def handler(self, src, target, opts=None): userdata=opts.get('userdata', None), ) + # need brew instrumentation to be completed to know where we will get this from + traceparent = '' + if traceparent: + kwargs.update({ + 'traceparent': traceparent, + }) + result = self.createContainer(**kwargs) self.logger.debug("Result: %r", result) @@ -1190,6 +1198,13 @@ def handler(self, target, opts=None): userdata=opts.get('userdata', None), ) + # need brew instrumentation to be completed to know where we will get this from + traceparent = '' + if traceparent: + kwargs.update({ + 'traceparent': traceparent, + }) + result = self.createSourceContainer(**kwargs) self.logger.debug("Result: %r", result) diff --git a/test.sh b/test.sh index 5b70380..4d7481b 100755 --- a/test.sh +++ b/test.sh @@ -71,7 +71,7 @@ function setup_kojic() { # from specified git source (default: upstream master) $RUN rm -rf /tmp/osbs-client $RUN git clone --depth 1 --single-branch \ - https://github.com/projectatomic/osbs-client --branch master /tmp/osbs-client + https://github.com/hjmodi/osbs-client --branch master /tmp/osbs-client # RPM install build dependencies for osbs-client $RUN "${BUILDDEP[@]}" --define "with_python3 ${WITH_PY3}" -y /tmp/osbs-client/osbs-client.spec @@ -79,7 +79,7 @@ function setup_kojic() { # This will also ensure all the deps are specified in the spec # Pip install osbs-client from git master $RUN "${PIP_INST[@]}" --upgrade --no-deps --force-reinstall \ - git+https://github.com/projectatomic/osbs-client + git+https://github.com/hjmodi/osbs-client # Pip install dockerfile-parse from git master $RUN "${PIP_INST[@]}" --upgrade --force-reinstall \ git+https://github.com/containerbuildsystem/dockerfile-parse