From a8214a7d9c001e93f61d29202b19fb44b1699f1a Mon Sep 17 00:00:00 2001 From: Jarkko Jaakola Date: Fri, 20 Dec 2024 09:17:40 +0200 Subject: [PATCH] chore: resolve otel version from import --- src/karapace/config.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/karapace/config.py b/src/karapace/config.py index 0dd811d92..710e94251 100644 --- a/src/karapace/config.py +++ b/src/karapace/config.py @@ -27,13 +27,22 @@ class KarapaceTags(BaseModel): app: str = "Karapace" +OTEL_VERSION = "" +try: + from opentelemetry import version as otel_version + + OTEL_VERSION = otel_version.__version__ +except: + pass + + class KarapaceTelemetry(BaseModel): otel_endpoint_url: str | None = None resource_service_name: str = "karapace" resource_service_instance_id: str = "karapace" resource_telemetry_sdk_name: str = "opentelemetry" resource_telemetry_sdk_language: str = "python" - resource_telemetry_sdk_version: str = "1.27.0" + resource_telemetry_sdk_version: str = OTEL_VERSION class Config(BaseSettings):