Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
yufansong committed Feb 26, 2024
1 parent 5f185d9 commit aabed69
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dashboard/mock-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ app.get("/metrics/cluster", (req, res, next) => {
res.json(require("./mock/metrics_cluster.json"))
})

app.get("/metrics/actor/back_pressures", (req, res, next) => {
res.json(require("./mock/actor_back_pressures.json"))
app.get("/metrics/fragment/prometheus_back_pressures", (req, res, next) => {
res.json(require("./mock/fragment_prometheus_back_pressures.json"))
})

app.get("/monitor/await_tree/1", (req, res, next) => {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/mock/fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ curl http://localhost:5691/api/internal_tables > internal_tables.json
curl http://localhost:5691/api/sinks > sinks.json
curl http://localhost:5691/api/sources > sources.json
curl http://localhost:5691/api/metrics/cluster > metrics_cluster.json
curl http://localhost:5691/api/metrics/actor/back_pressures > actor_back_pressures.json
curl http://localhost:5691/api/metrics/fragment/prometheus_back_pressures > fragment_prometheus_back_pressures.json
curl http://localhost:5691/api/monitor/await_tree/1 > await_tree_1.json
4 changes: 2 additions & 2 deletions dashboard/pages/api/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface BackPressuresMetrics {
// Get back pressure from meta node -> prometheus
export async function getActorBackPressures() {
const res: BackPressuresMetrics = await api.get(
"/metrics/actor/back_pressures"
"/metrics/fragment/prometheus_back_pressures"
)
return res
}
Expand Down Expand Up @@ -150,7 +150,7 @@ export const BackPressureInfo = {

// Get back pressure from meta node -> compute node
export async function getBackPressureWithoutPrometheus() {
const response = await api.get("/metrics/back_pressures")
const response = await api.get("/metrics/embedded_back_pressures")
let backPressureInfos: BackPressureInfo[] = response.backPressureInfos.map(
BackPressureInfo.fromJSON
)
Expand Down
11 changes: 7 additions & 4 deletions src/meta/src/dashboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ pub(super) mod handlers {
Ok(srv.diagnose_command.report().await)
}

pub async fn get_back_pressure(
pub async fn get_embedded_back_pressures(
Extension(srv): Extension<Service>,
) -> Result<Json<GetBackPressureResponse>> {
let worker_nodes = srv
Expand Down Expand Up @@ -416,10 +416,13 @@ impl DashboardService {
.route("/sinks", get(list_sinks))
.route("/metrics/cluster", get(prometheus::list_prometheus_cluster))
.route(
"/metrics/actor/back_pressures",
get(prometheus::list_prometheus_actor_back_pressure),
"/metrics/fragment/prometheus_back_pressures",
get(prometheus::list_prometheus_fragment_back_pressure),
)
.route(
"/metrics/embedded_back_pressures",
get(get_embedded_back_pressures),
)
.route("/metrics/back_pressures", get(get_back_pressure))
.route("/monitor/await_tree/:worker_id", get(dump_await_tree))
.route("/monitor/await_tree/", get(dump_await_tree_all))
.route("/monitor/dump_heap_profile/:worker_id", get(heap_profile))
Expand Down
8 changes: 4 additions & 4 deletions src/meta/src/dashboard/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ pub async fn list_prometheus_cluster(

#[derive(Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ActorBackPressure {
pub struct FragmentBackPressure {
output_buffer_blocking_duration: Vec<PrometheusVector>,
}
pub async fn list_prometheus_actor_back_pressure(
pub async fn list_prometheus_fragment_back_pressure(
Extension(srv): Extension<Service>,
) -> Result<Json<ActorBackPressure>> {
) -> Result<Json<FragmentBackPressure>> {
if let Some(ref client) = srv.prometheus_client {
let now = SystemTime::now();
let back_pressure_query =
Expand All @@ -159,7 +159,7 @@ pub async fn list_prometheus_actor_back_pressure(
.iter()
.map(PrometheusVector::from)
.collect();
Ok(Json(ActorBackPressure {
Ok(Json(FragmentBackPressure {
output_buffer_blocking_duration: back_pressure_data,
}))
} else {
Expand Down

0 comments on commit aabed69

Please sign in to comment.