SIENTIAPDE-1169
feat: add SDK metrics service and update telemetry configuration - Introduced a new service for SDK metrics in values.yaml, enabling metrics collection on port 9091. - Updated the worker.py to initialize a new runtime with Prometheus metrics configuration for the SDK metrics server. - Adjusted environment variable for GITHUB_BRANCH to reflect the current focus on testing and performance design.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from temporalio import workflow, client
|
from temporalio import workflow, client
|
||||||
from temporalio.worker import Worker
|
from temporalio.worker import Worker
|
||||||
|
from temporalio.runtime import Runtime, TelemetryConfig, PrometheusConfig
|
||||||
|
|
||||||
with workflow.unsafe.imports_passed_through():
|
with workflow.unsafe.imports_passed_through():
|
||||||
import os
|
import os
|
||||||
@@ -26,6 +26,7 @@ with workflow.unsafe.imports_passed_through():
|
|||||||
from orchestrator import metrics
|
from orchestrator import metrics
|
||||||
|
|
||||||
POD_ID = os.getenv("POD_ID")
|
POD_ID = os.getenv("POD_ID")
|
||||||
|
SDK_METRICS_PORT = int(os.getenv('HTTP_SDK_METRICS_PORT', "9091"))
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
@@ -55,11 +56,21 @@ async def main():
|
|||||||
project_name=os.getenv('PROJECT_NAME', 'orchestrator'),
|
project_name=os.getenv('PROJECT_NAME', 'orchestrator'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.info(f'Starting SDK Metrics Server on port {SDK_METRICS_PORT}...')
|
||||||
|
|
||||||
|
new_runtime = Runtime(
|
||||||
|
telemetry=TelemetryConfig(
|
||||||
|
metrics=PrometheusConfig(
|
||||||
|
bind_address=f"0.0.0.0:{SDK_METRICS_PORT}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
logger.info(f'Starting Temporal Client at {host}:{namespace}')
|
logger.info(f'Starting Temporal Client at {host}:{namespace}')
|
||||||
|
|
||||||
temporal_client = await client.Client.connect(
|
temporal_client = await client.Client.connect(
|
||||||
target_host=host,
|
target_host=host,
|
||||||
namespace=namespace
|
namespace=os.getenv('TEMPORAL_NAMESPACE', 'laborious'),
|
||||||
|
runtime=new_runtime
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info('Starting Activities...')
|
logger.info('Starting Activities...')
|
||||||
|
|||||||
29
values.yaml
29
values.yaml
@@ -112,6 +112,13 @@ tolerations: []
|
|||||||
affinity: {}
|
affinity: {}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
sdk-metrics:
|
||||||
|
enabled: true
|
||||||
|
type: ClusterIP
|
||||||
|
port: 9091
|
||||||
|
targetPort: 9091
|
||||||
|
name: sdk-metrics
|
||||||
|
|
||||||
metrics:
|
metrics:
|
||||||
enabled: true
|
enabled: true
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
@@ -125,18 +132,18 @@ serviceMonitor:
|
|||||||
# Se true, um recurso ServiceMonitor será criado.
|
# Se true, um recurso ServiceMonitor será criado.
|
||||||
enabled: true
|
enabled: true
|
||||||
# O intervalo no qual as métricas devem ser coletadas (ex: 30s, 1m).
|
# O intervalo no qual as métricas devem ser coletadas (ex: 30s, 1m).
|
||||||
interval: 30s
|
endpoints:
|
||||||
# O path do endpoint de métricas na sua aplicação.
|
- port: metrics
|
||||||
path: /metrics
|
path: /metrics
|
||||||
# Labels adicionais para o recurso ServiceMonitor.
|
interval: 30s
|
||||||
# Essencial para que o Prometheus Operator o descubra. Se você usa o helm chart kube-prometheus-stack,
|
relabelings: []
|
||||||
# ele procura por ServiceMonitors com o label "release: kube-prometheus-stack".
|
- port: sdk-metrics
|
||||||
|
path: /metrics
|
||||||
|
interval: 30s
|
||||||
|
relabelings: []
|
||||||
|
|
||||||
additionalLabels:
|
additionalLabels:
|
||||||
release: kube-prometheus-stack
|
release: kube-prometheus-stack
|
||||||
# Configurações de relabeling adicionais, se necessário.
|
|
||||||
# ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
|
|
||||||
relabelings: []
|
|
||||||
port: metrics
|
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -144,7 +151,7 @@ env:
|
|||||||
- name: GITHUB_REPO_URL
|
- name: GITHUB_REPO_URL
|
||||||
value: "git@github.com:Aignosi/sientia-dataops-orchestrator_temporal.git"
|
value: "git@github.com:Aignosi/sientia-dataops-orchestrator_temporal.git"
|
||||||
- name: GITHUB_BRANCH
|
- name: GITHUB_BRANCH
|
||||||
value: "SIENTIAPDE-1184-investigar-bugs-detectados-no-grafana"
|
value: "SIENTIAPDE-1169-pensar-e-projetar-testes-de-breakdown-e-performance"
|
||||||
- name: PYTHON_APP
|
- name: PYTHON_APP
|
||||||
value: "orchestrator.worker.worker"
|
value: "orchestrator.worker.worker"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user