Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
chore: expose grpc request entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
hadjiszs committed Aug 1, 2023
1 parent 39ad817 commit 51431ab
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/topos-metrics/src/api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use prometheus::{self, register_int_counter_with_registry, IntCounter};

use lazy_static::lazy_static;

use crate::TOPOS_METRIC_REGISTRY;

lazy_static! {
pub static ref API_GRPC_CERTIFICATE_RECEIVED_TOTAL: IntCounter =
register_int_counter_with_registry!(
"api_grpc_certificate_received_total",
"Number of Certificates received from the gRPC API.",
TOPOS_METRIC_REGISTRY
)
.unwrap();
}
2 changes: 2 additions & 0 deletions crates/topos-metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ use prometheus::{

use lazy_static::lazy_static;

mod api;
mod double_echo;
mod p2p;
mod storage;

pub use api::*;
pub use double_echo::*;
pub use p2p::*;
pub use storage::*;
Expand Down
3 changes: 3 additions & 0 deletions crates/topos-tce-api/src/grpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use topos_core::api::grpc::tce::v1::{
};
use topos_core::api::grpc::uci::v1::OptionalCertificate;
use topos_core::uci::SubnetId;
use topos_metrics::API_GRPC_CERTIFICATE_RECEIVED_TOTAL;
use tracing::{error, info, Span};
use uuid::Uuid;

Expand Down Expand Up @@ -106,6 +107,8 @@ impl ApiService for TceGrpcService {
.is_err()
{
return Err(Status::internal("Can't submit certificate: sender dropped"));
} else {
API_GRPC_CERTIFICATE_RECEIVED_TOTAL.inc();
}

receiver
Expand Down
1 change: 1 addition & 0 deletions crates/topos-tce-api/src/metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub(crate) mod builder;

0 comments on commit 51431ab

Please sign in to comment.