SIENTIAPDE-1169

SIENTIAPDE-1174 Add SDK metrics configuration and update worker for telemetry

- Introduced sdk-metrics service in values.yaml with ClusterIP configuration.
- Updated worker.py to integrate SDK metrics telemetry using the new HTTP_SDK_METRICS_PORT environment variable.
- Enhanced Prometheus configuration to bind SDK metrics to the specified port.
This commit is contained in:
vitor-aignosi
2025-08-18 09:41:17 -03:00
parent 7f3457e318
commit a2a9f95aa5
2 changed files with 30 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
from temporalio import workflow, client
from temporalio.worker import Worker
from temporalio.runtime import Runtime, TelemetryConfig, PrometheusConfig
with workflow.unsafe.imports_passed_through():
import os
@@ -24,6 +24,7 @@ with workflow.unsafe.imports_passed_through():
from prometheus_client import start_http_server
POD_ID = os.getenv('POD_ID')
SDK_METRICS_PORT = int(os.getenv('HTTP_SDK_METRICS_PORT', "9091"))
async def main():
@@ -57,9 +58,17 @@ async def main():
logger.info('Starting Temporal Client...')
new_runtime = Runtime(
telemetry=TelemetryConfig(
metrics=PrometheusConfig(
bind_address=f"0.0.0.0:{SDK_METRICS_PORT}")
)
)
temporal_client = await client.Client.connect(
target_host=host,
namespace=os.getenv('TEMPORAL_NAMESPACE', 'laborious')
namespace=os.getenv('TEMPORAL_NAMESPACE', 'laborious'),
runtime=new_runtime
)
logger.info('Starting Workers...')