Skip to content

Commit

Permalink
Revert "feat: add http metrics (#280)" (#281)
Browse files Browse the repository at this point in the history
This reverts commit 36a4f63.
  • Loading branch information
filipdulic authored Jan 10, 2025
1 parent 36a4f63 commit c427d60
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 104 deletions.
8 changes: 6 additions & 2 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ impl Api {
.await
{
GetStatusResponse::Ok(x) => {
self.status_counter.with_label_values(&["success"]).inc();
self.status_counter
.with_label_values(&[&"success".to_string()])
.inc();
GetStatusResponse::Ok(x)
}
GetStatusResponse::TaskNotFound(x) => GetStatusResponse::TaskNotFound(x),
GetStatusResponse::InternalServerError(e) => {
self.status_counter.with_label_values(&["fail"]).inc();
self.status_counter
.with_label_values(&[&"fail".to_string()])
.inc();
GetStatusResponse::InternalServerError(e)
}
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod api;
pub mod middleware;
pub mod services;
12 changes: 3 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::io::ErrorKind;
use std::sync::Arc;

use poem::endpoint::{EndpointExt, PrometheusExporter};
use poem::endpoint::PrometheusExporter;
use poem::{listener::TcpListener, Route, Server};
use poem_openapi::OpenApiService;
use prometheus::Registry;

use substrate_runtime_builder::{
api::Api,
middleware::metrics::MetricsMiddleware,
services::{
async_zip::AsyncZipArchiverService, code_generator::service::CodeGeneratorService,
git::GitService, s3::S3ObjectStoreService,
Expand Down Expand Up @@ -57,15 +56,10 @@ async fn main() -> Result<(), std::io::Error> {
)
.server(hosted_url);
let ui = api_service.swagger_ui();
let metrics_middleware = MetricsMiddleware::new(&prometheus_registry);

tokio::spawn(async move {
Server::new(TcpListener::bind(format!("0.0.0.0:{PORT}")))
.run(
Route::new()
.nest("/", api_service)
.nest("/docs", ui)
.with(metrics_middleware),
)
.run(Route::new().nest("/", api_service).nest("/docs", ui))
.await
});
Server::new(TcpListener::bind(format!("0.0.0.0:{METRICS_PORT}")))
Expand Down
91 changes: 0 additions & 91 deletions src/middleware/metrics.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/middleware/mod.rs

This file was deleted.

0 comments on commit c427d60

Please sign in to comment.