Skip to content

Commit dd29249

Browse files
authored
Merge pull request #754 from tursodatabase/lucio/small-improvements
sqld: metrics & logging improvements
2 parents 9543ae9 + 8a65caa commit dd29249

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libsql-server/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub enum Error {
9797
trait ResponseError: std::error::Error {
9898
fn format_err(&self, status: StatusCode) -> axum::response::Response {
9999
let json = serde_json::json!({ "error": self.to_string() });
100-
tracing::error!("HTTP API: {}, {}", status, json);
100+
tracing::error!("HTTP API: {}, {:?}", status, self);
101101
(status, axum::Json(json)).into_response()
102102
}
103103
}

libsql-server/src/http/admin/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ where
7272
C: Connector,
7373
{
7474
let app_label = std::env::var("SQLD_APP_LABEL").ok();
75+
let ver = env!("CARGO_PKG_VERSION");
7576

7677
let prom_handle = if !disable_metrics {
7778
let lock = PROM_HANDLE.lock();
@@ -84,6 +85,7 @@ where
8485

8586
if let Some(app_label) = app_label {
8687
b.add_global_label("app", app_label)
88+
.add_global_label("version", ver)
8789
.install_recorder()
8890
.unwrap()
8991
} else {
@@ -95,6 +97,8 @@ where
9597
None
9698
};
9799

100+
metrics::increment_counter!("libsql_server_count");
101+
98102
use axum::routing::{get, post};
99103
let metrics = Metrics {
100104
handle: prom_handle,

0 commit comments

Comments
 (0)