Skip to content

Commit

Permalink
feat: add cluster/metrics endpoint (#717)
Browse files Browse the repository at this point in the history
1. add: new endpoint /cluster/metrics
2. add: prometheus metrics parser
3. chore: code cleanup
  • Loading branch information
Eshanatnight authored Mar 27, 2024
1 parent 81b241d commit c254fd6
Show file tree
Hide file tree
Showing 11 changed files with 784 additions and 558 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ serde_repr = "0.1.17"
hashlru = { version = "0.11.0", features = ["serde"] }
path-clean = "1.0.1"
prost = "0.12.3"
prometheus-parse = "0.2.5"

[build-dependencies]
cargo_toml = "0.15"
Expand Down
7 changes: 4 additions & 3 deletions server/src/handlers/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ use actix_cors::Cors;
use arrow_schema::Schema;
use serde_json::Value;

use self::{modal::query_server::QueryServer, query::Query};
use self::{cluster::get_ingester_info, query::Query};

pub(crate) mod about;
pub mod cluster;
pub(crate) mod health_check;
pub(crate) mod ingest;
mod kinesis;
Expand Down Expand Up @@ -62,7 +63,7 @@ pub fn base_path_without_preceding_slash() -> String {

pub async fn fetch_schema(stream_name: &str) -> anyhow::Result<arrow_schema::Schema> {
let mut res = vec![];
let ima = QueryServer::get_ingester_info().await.unwrap();
let ima = get_ingester_info().await.unwrap();

for im in ima {
let uri = format!(
Expand Down Expand Up @@ -92,7 +93,7 @@ pub async fn fetch_schema(stream_name: &str) -> anyhow::Result<arrow_schema::Sch
pub async fn send_query_request_to_ingester(query: &Query) -> anyhow::Result<Vec<Value>> {
// send the query request to the ingester
let mut res = vec![];
let ima = QueryServer::get_ingester_info().await.unwrap();
let ima = get_ingester_info().await.unwrap();

for im in ima.iter() {
let uri = format!(
Expand Down
Loading

0 comments on commit c254fd6

Please sign in to comment.