From e6e0b40c6cd45294ec751cc21640a69f2f9d359b Mon Sep 17 00:00:00 2001 From: Everaldo Date: Wed, 10 Jun 2026 19:04:43 -0400 Subject: [PATCH 1/5] Fix OpenTelemetry. --- docker/Dockerfile | 2 +- docker/configuration/config.json | 2 +- pyproject.toml | 3 +-- src/nodenorm/config/config.default.json | 6 +++--- src/nodenorm/namespace.py | 20 ++++++++++++-------- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 53d34f7..fcd720f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,7 +6,7 @@ ARG NODENORM_BRANCH=main WORKDIR /build/nodenorm RUN git clone -b ${NODENORM_BRANCH} --recursive ${NODENORM_REPO} . RUN git rev-parse HEAD > /build/nodenorm/version.txt -RUN pip wheel --wheel-dir=/build/wheels /build/nodenorm +RUN pip wheel --wheel-dir=/build/wheels /build/nodenorm[telemetry] FROM caddy:2.8-builder AS caddy_builder RUN xcaddy build diff --git a/docker/configuration/config.json b/docker/configuration/config.json index e38ab0a..e43900c 100644 --- a/docker/configuration/config.json +++ b/docker/configuration/config.json @@ -27,6 +27,6 @@ "OPENTELEMETRY_ENABLED": false, "OPENTELEMETRY_SERVICE_NAME": "NodeNorm", "OPENTELEMETRY_JAEGER_HOST": "http://localhost", - "OPENTELEMETRY_JAEGER_PORT": 6831 + "OPENTELEMETRY_JAEGER_PORT": 4318 } } diff --git a/pyproject.toml b/pyproject.toml index 137efad..f947017 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,8 +59,7 @@ tests = [ telemetry = [ "opentelemetry-api>=1.21.0", "opentelemetry-sdk>=1.21.0", - "opentelemetry-exporter-otlp>=1.21.0", - "opentelemetry.exporter.jaeger.thrift>=1.21.0", + "opentelemetry-exporter-otlp-proto-http>=1.21.0", "opentelemetry-instrumentation>=0.42b0", "opentelemetry-instrumentation-tornado>=0.42b0", "deprecated>=1.2.0" diff --git a/src/nodenorm/config/config.default.json b/src/nodenorm/config/config.default.json index 99e1c26..601f981 100644 --- a/src/nodenorm/config/config.default.json +++ b/src/nodenorm/config/config.default.json @@ -14,8 +14,8 @@ }, "elasticsearch": { "ES_HOST": "http://localhost:9200", - "ES_INDEX": "nodenorm", - "ES_ALIAS": "nodenorm", + "ES_INDEX": "annotator-nodenorm", + "ES_ALIAS": "annotator-nodenorm", "ES_DOC_TYPE": "node", "ES_INDICES": {}, "ES_ARGS": { @@ -27,6 +27,6 @@ "OPENTELEMETRY_ENABLED": false, "OPENTELEMETRY_SERVICE_NAME": "NodeNorm", "OPENTELEMETRY_JAEGER_HOST": "http://localhost", - "OPENTELEMETRY_JAEGER_PORT": 6831 + "OPENTELEMETRY_JAEGER_PORT": 4318 } } diff --git a/src/nodenorm/namespace.py b/src/nodenorm/namespace.py index 55bc6f2..465c560 100644 --- a/src/nodenorm/namespace.py +++ b/src/nodenorm/namespace.py @@ -34,11 +34,11 @@ def _is_open_telemetry_configurable(self) -> bool: opentelemetry_module = "opentelemetry" opentelemetry_installed = ( - opentelemetry_module not in sys.modules and importlib.util.find_spec(opentelemetry_module) is None + opentelemetry_module in sys.modules or importlib.util.find_spec(opentelemetry_module) is not None ) if not opentelemetry_enabled: - logger.debug( + logger.info( "OPENTELEMETRY is disabled. If you wish to enable it, set the OPENTELEMETRY_ENABLED value to " ) return False @@ -52,6 +52,10 @@ def _is_open_telemetry_configurable(self) -> bool: ) return False + logger.info( + "OPENTELEMETRY is enabled. If you wish to disable it, set the OPENTELEMETRY_ENABLED value to " + ) + return opentelemetry_enabled and opentelemetry_installed def configure_elasticsearch(self) -> types.SimpleNamespace: @@ -98,7 +102,7 @@ def _validate_elasticsearch_index(self, elasticsearch_namespace: types.SimpleNam def configure_telemetry(self): """Configure our opentelemetry for our web API.""" from opentelemetry.instrumentation.tornado import TornadoInstrumentor # pylint: disable=import-outside-toplevel - from opentelemetry.exporter.jaeger.thrift import JaegerExporter # pylint: disable=import-outside-toplevel + from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter # pylint: disable=import-outside-toplevel from opentelemetry.sdk.resources import SERVICE_NAME, Resource # pylint: disable=import-outside-toplevel from opentelemetry.sdk.trace import TracerProvider # pylint: disable=import-outside-toplevel from opentelemetry.sdk.trace.export import BatchSpanProcessor # pylint: disable=import-outside-toplevel @@ -106,11 +110,11 @@ def configure_telemetry(self): TornadoInstrumentor().instrument() - trace_exporter = JaegerExporter( - agent_host_name=self.config.telemetry["OPENTELEMETRY_JAEGER_HOST"], - agent_port=self.config.telemetry["OPENTELEMETRY_JAEGER_PORT"], - udp_split_oversized_batches=True, - ) + jaeger_host = self.config.telemetry["OPENTELEMETRY_JAEGER_HOST"] + jaeger_port = self.config.telemetry["OPENTELEMETRY_JAEGER_PORT"] + otlp_endpoint = f"{jaeger_host}:{jaeger_port}/v1/traces" + + trace_exporter = OTLPSpanExporter(endpoint=otlp_endpoint) trace_provider = TracerProvider( resource=Resource.create({SERVICE_NAME: self.config.telemetry["OPENTELEMETRY_SERVICE_NAME"]}) From 0bdfacd68629e85b2ebfbb0b6b0f1beef342316c Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 11 Jun 2026 09:53:25 -0400 Subject: [PATCH 2/5] Enable opentelemetry for docker. --- docker/configuration/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/configuration/config.json b/docker/configuration/config.json index e43900c..43137f1 100644 --- a/docker/configuration/config.json +++ b/docker/configuration/config.json @@ -24,7 +24,7 @@ } }, "telemetry": { - "OPENTELEMETRY_ENABLED": false, + "OPENTELEMETRY_ENABLED": true, "OPENTELEMETRY_SERVICE_NAME": "NodeNorm", "OPENTELEMETRY_JAEGER_HOST": "http://localhost", "OPENTELEMETRY_JAEGER_PORT": 4318 From db8c51905b05a562e4161fc8eb4a8588f115271e Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 11 Jun 2026 10:15:08 -0400 Subject: [PATCH 3/5] Set jaeger endpoint on docker. --- docker/configuration/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/configuration/config.json b/docker/configuration/config.json index 43137f1..35739e4 100644 --- a/docker/configuration/config.json +++ b/docker/configuration/config.json @@ -26,7 +26,7 @@ "telemetry": { "OPENTELEMETRY_ENABLED": true, "OPENTELEMETRY_SERVICE_NAME": "NodeNorm", - "OPENTELEMETRY_JAEGER_HOST": "http://localhost", + "OPENTELEMETRY_JAEGER_HOST": "http://jaeger-otel.sri", "OPENTELEMETRY_JAEGER_PORT": 4318 } } From 7417156cd0b5b4b100e2f89b2828f5ad75752c77 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 11 Jun 2026 10:30:37 -0400 Subject: [PATCH 4/5] Set jaeger endpoint on docker. --- docker/configuration/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/configuration/config.json b/docker/configuration/config.json index 35739e4..c033b4a 100644 --- a/docker/configuration/config.json +++ b/docker/configuration/config.json @@ -26,7 +26,7 @@ "telemetry": { "OPENTELEMETRY_ENABLED": true, "OPENTELEMETRY_SERVICE_NAME": "NodeNorm", - "OPENTELEMETRY_JAEGER_HOST": "http://jaeger-otel.sri", + "OPENTELEMETRY_JAEGER_HOST": "http://jaeger-otel-collector.sri", "OPENTELEMETRY_JAEGER_PORT": 4318 } } From 3725d616ee1718fc4d139759e463598c61ef65c5 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 11 Jun 2026 10:31:14 -0400 Subject: [PATCH 5/5] Update opentelemetry dependencies. --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f947017..d51b7f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,12 +57,12 @@ tests = [ ] telemetry = [ - "opentelemetry-api>=1.21.0", - "opentelemetry-sdk>=1.21.0", - "opentelemetry-exporter-otlp-proto-http>=1.21.0", - "opentelemetry-instrumentation>=0.42b0", - "opentelemetry-instrumentation-tornado>=0.42b0", - "deprecated>=1.2.0" + "opentelemetry-api>=1.42.1", + "opentelemetry-sdk>=1.42.1", + "opentelemetry-exporter-otlp-proto-http>=1.42.1", + "opentelemetry-instrumentation>=0.63b1", + "opentelemetry-instrumentation-tornado>=0.63b1", + "deprecated>=1.3.1" ]