Fix usage of deprecated startMetricsHttpServer call

This commit is contained in:
kdeme 2024-02-17 10:05:25 +01:00
parent 2766e20179
commit 62bb6cfe9e
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
2 changed files with 22 additions and 9 deletions

View File

@ -244,13 +244,19 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
let
address = config.metricsAddress
port = config.metricsPort
info "Starting metrics HTTP server",
url = "http://" & $address & ":" & $port & "/metrics"
server = MetricsHttpServerRef.new($address, port).valueOr:
error "Could not start metrics HTTP server", url, error
quit QuitFailure
info "Starting metrics HTTP server", url
try:
chronos_httpserver.startMetricsHttpServer($address, port)
except CatchableError as exc: raise exc
# TODO: Ideally we don't have the Exception here
except Exception as exc: raiseAssert exc.msg
waitFor server.start()
except MetricsError as exc:
fatal "Could not start metrics HTTP server", url,
error_msg = exc.msg, error_name = exc.name
quit QuitFailure
## Starting the different networks.
d.start()

View File

@ -236,12 +236,19 @@ proc run(config: PortalCliConf) =
let
address = config.metricsAddress
port = config.metricsPort
notice "Starting metrics HTTP server",
url = "http://" & $address & ":" & $port & "/metrics"
server = MetricsHttpServerRef.new($address, port).valueOr:
error "Could not start metrics HTTP server", url, error
quit QuitFailure
info "Starting metrics HTTP server", url
try:
chronos_httpserver.startMetricsHttpServer($address, port)
except CatchableError as exc: raise exc
except Exception as exc: raiseAssert exc.msg # TODO fix metrics
waitFor server.start()
except MetricsError as exc:
fatal "Could not start metrics HTTP server", url,
error_msg = exc.msg, error_name = exc.name
quit QuitFailure
case config.cmd
of ping: