Skip to content

Commit

Permalink
Perf stats on index page
Browse files Browse the repository at this point in the history
  • Loading branch information
cswinter committed Aug 11, 2024
1 parent 70ce1dd commit 6aa4801
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scheduler/inner_locustdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl InnerLocustDB {
None =>
log::info!("Performed wal flush in {total_time:?} (batching: {time_batching:?}, compaction: {time_compaction:?})"),
Some((lock_time, write_time_partitions, write_time_meta, delete_time_wal)) => {
log::info!("Performed wal flush in {total_time:?} (batching: {time_batching:?}, compaction: {time_compaction:?}), lock: {lock_time:?}, write partitions: {write_time_partitions:?}, write meta: {write_time_meta:?}, delete wal: {delete_time_wal:?}");
log::info!("Performed wal flush in {total_time:?} (batching: {time_batching:?}, compaction: {time_compaction:?}, lock: {lock_time:?}, write partitions: {write_time_partitions:?}, write meta: {write_time_meta:?}, delete wal: {delete_time_wal:?})");
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct AppState {
#[get("/")]
async fn index(data: web::Data<AppState>) -> impl Responder {
let mut context = Context::new();

let mut ts: Vec<String> = data
.db
.table_stats()
Expand All @@ -62,6 +63,21 @@ async fn index(data: web::Data<AppState>) -> impl Responder {
.collect::<Vec<_>>();
ts.sort();
context.insert("tables", &ts);

let perf_counter = data.db.perf_counter();
context.insert("disk_write_bytes", &perf_counter.disk_write_bytes());
context.insert("disk_write_new_partition_bytes", &perf_counter.disk_write_new_partition_bytes());
context.insert("disk_write_compaction_bytes", &perf_counter.disk_write_compaction_bytes());
context.insert("disk_write_meta_store_bytes", &perf_counter.disk_write_meta_store_bytes());
context.insert("files_created", &perf_counter.files_created());
context.insert("files_created_wal", &perf_counter.files_created_wal());
context.insert("files_created_new_partition", &perf_counter.files_created_new_partition());
context.insert("files_created_meta_store", &perf_counter.files_created_meta_store());
context.insert("ingestion_requests", &perf_counter.ingestion_requests());
context.insert("ingestion_bytes", &perf_counter.network_read_ingestion_bytes());
context.insert("files_opened_partition", &perf_counter.files_opened_partition());
context.insert("disk_read_partition_bytes", &perf_counter.disk_read_partition_bytes());

let body = TEMPLATES.render("index.html", &context).unwrap();
HttpResponse::Ok()
.content_type("text/html; charset=utf8")
Expand Down
14 changes: 14 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ <h2>Tables</h2>
{% endfor %}
</ul>

<h2>Perf stats</h2>
disk_write_bytes: {{ disk_write_bytes }}<br>
disk_write_new_partition_bytes: {{ disk_write_new_partition_bytes }}<br>
disk_write_compaction_bytes: {{ disk_write_compaction_bytes }}<br>
disk_write_meta_store_bytes: {{ disk_write_meta_store_bytes }}<br>
files_created: {{ files_created }}<br>
files_created_wal: {{ files_created_wal }}<br>
files_created_new_partition: {{ files_created_new_partition }}<br>
files_created_meta_store: {{ files_created_meta_store }}<br>
ingestion_requests: {{ ingestion_requests }}<br>
ingestion_bytes: {{ ingestion_bytes }}<br>
files_opened_partition: {{ files_opened_partition }}<br>
disk_read_partition_bytes: {{ disk_read_partition_bytes }}<br>

<h2>Run query</h2>
<!-- Large text input box for queries -->
<form id="query-form">
Expand Down

0 comments on commit 6aa4801

Please sign in to comment.