Skip to content

Commit 735526f

Browse files
author
Andrei Neagu
committed
added tracing to dynamic-sidecar
1 parent 0c27024 commit 735526f

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/docker_service_specs/sidecar.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import logging
23
from copy import deepcopy
34
from typing import Any, NamedTuple
@@ -175,6 +176,7 @@ def _get_environment_variables(
175176
"S3_SECRET_KEY": r_clone_settings.R_CLONE_S3.S3_SECRET_KEY,
176177
"SC_BOOT_MODE": f"{app_settings.DYNAMIC_SERVICES.DYNAMIC_SIDECAR.DYNAMIC_SIDECAR_SC_BOOT_MODE}",
177178
"SSL_CERT_FILE": app_settings.DIRECTOR_V2_SELF_SIGNED_SSL_FILENAME,
179+
"DYNAMIC_SIDECAR_TRACING": json.dumps(app_settings.DIRECTOR_V2_TRACING),
178180
# For background info on this special env-var above, see
179181
# - https://stackoverflow.com/questions/31448854/how-to-force-requests-use-the-certificates-on-my-ubuntu-system#comment78596389_37447847
180182
"SIMCORE_HOST_NAME": scheduler_data.service_name,

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/application.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
get_common_oas_options,
1010
override_fastapi_openapi_method,
1111
)
12+
from servicelib.fastapi.tracing import setup_tracing
1213
from servicelib.logging_utils import config_all_loggers
1314
from simcore_sdk.node_ports_common.exceptions import NodeNotFound
1415

@@ -190,6 +191,9 @@ def create_app():
190191
if application_settings.are_prometheus_metrics_enabled:
191192
setup_prometheus_metrics(app)
192193

194+
if application_settings.DYNAMIC_SIDECAR_TRACING:
195+
setup_tracing(app, application_settings.DYNAMIC_SIDECAR_TRACING, PROJECT_NAME)
196+
193197
# ERROR HANDLERS ------------
194198
app.add_exception_handler(NodeNotFound, node_not_found_error_handler)
195199
app.add_exception_handler(BaseDynamicSidecarError, http_error_handler)

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from settings_library.resource_usage_tracker import (
2424
DEFAULT_RESOURCE_USAGE_HEARTBEAT_INTERVAL,
2525
)
26+
from settings_library.tracing import TracingSettings
2627
from settings_library.utils_logging import MixinLoggingSettings
2728

2829

@@ -167,6 +168,10 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
167168

168169
SYSTEM_MONITOR_SETTINGS: SystemMonitorSettings = Field(auto_default_from_env=True)
169170

171+
DYNAMIC_SIDECAR_TRACING: TracingSettings | None = Field(
172+
auto_default_from_env=True, description="settings for opentelemetry tracing"
173+
)
174+
170175
@property
171176
def are_prometheus_metrics_enabled(self) -> bool:
172177
return self.DY_SIDECAR_CALLBACKS_MAPPING.metrics is not None

services/dynamic-sidecar/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def base_mock_envs(
199199
"REGISTRY_SSL": "false",
200200
}
201201
),
202+
"DYNAMIC_SIDECAR_TRACING": "null",
202203
}
203204

204205

0 commit comments

Comments
 (0)