From 1ffd22ffbe710469de0e7f27c6aae29453ec6d3e Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 25 Oct 2024 08:44:37 +0200 Subject: [PATCH] fix(tee_prover): add prometheus pull listener (#3169) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Add a prometheus pull listener. ## Why ❔ To get the metrics out of the zk_tee_prover ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [x] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`. Signed-off-by: Harald Hoyer --- core/bin/zksync_tee_prover/src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/bin/zksync_tee_prover/src/main.rs b/core/bin/zksync_tee_prover/src/main.rs index 70c6f888185a..aa0881011da1 100644 --- a/core/bin/zksync_tee_prover/src/main.rs +++ b/core/bin/zksync_tee_prover/src/main.rs @@ -45,11 +45,12 @@ fn main() -> anyhow::Result<()> { .add_layer(SigintHandlerLayer) .add_layer(TeeProverLayer::new(tee_prover_config)); - if let Some(gateway) = prometheus_config.gateway_endpoint() { - let exporter_config = - PrometheusExporterConfig::push(gateway, prometheus_config.push_interval()); - builder.add_layer(PrometheusExporterLayer(exporter_config)); - } + let exporter_config = if let Some(gateway) = prometheus_config.gateway_endpoint() { + PrometheusExporterConfig::push(gateway, prometheus_config.push_interval()) + } else { + PrometheusExporterConfig::pull(prometheus_config.listener_port) + }; + builder.add_layer(PrometheusExporterLayer(exporter_config)); builder.build().run(observability_guard)?; Ok(())