Skip to content

Commit

Permalink
Don't start prometheus exporter server (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison authored Jan 26, 2024
1 parent 1d635ef commit a91f131
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions workers/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
import logging
import os
import sys
import threading
from typing import List
from urllib.parse import urlparse
from wsgiref.simple_server import make_server

from prometheus_client import make_wsgi_app
from pythonjsonlogger import jsonlogger
from temporalio.client import Client, TLSConfig
from temporalio.client import Client
from temporalio.runtime import (
LoggingConfig,
PrometheusConfig,
Runtime,
TelemetryConfig,
TelemetryFilter,
)
from temporalio.service import TLSConfig
from temporalio.worker import Worker

from activities import delay_activity, noop_activity
Expand Down Expand Up @@ -125,22 +122,11 @@ async def run():
logger.addHandler(logHandler)
logger.setLevel(nameToLevel[args.log_level.upper()])

# Configure metrics
prometheus = None
if args.prom_listen_address:
prom_addr = urlparse(args.prom_listen_address)
metrics_app = make_wsgi_app()
handle_path = args.prom_handler_path

def prom_app(environ, start_fn):
if environ["PATH_INFO"] == handle_path:
return metrics_app(environ, start_fn)

httpd = make_server(prom_addr.hostname, prom_addr.port, prom_app)
t = threading.Thread(target=httpd.serve_forever)
t.daemon = True
t.start()
prometheus = PrometheusConfig(bind_address=parser.prom_listen_address)
prometheus = (
PrometheusConfig(bind_address=args.prom_listen_address)
if args.prom_listen_address
else None
)

new_runtime = Runtime(
telemetry=TelemetryConfig(
Expand Down

0 comments on commit a91f131

Please sign in to comment.