-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query add http api /v1/status #4454
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/databend/databend/Hh7CBw3H5Pqy7JJ55heY4q7G9Skb [Deployment for b2f5874 canceled] |
Thanks for the contribution! Please review the labels and make any necessary changes. |
use crate::sessions::SessionManager; | ||
|
||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug)] | ||
pub struct Status { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also cover tenant_id and cluster_id? since those things update dynamically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I will check it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since those things update dynamically
do you mean reload_config, what about get tenant_id and cluster_id through /v1/config?
|
||
fn secs_since_epoch(t: SystemTime) -> u64 { | ||
t.duration_since(SystemTime::UNIX_EPOCH) | ||
.expect("Time went backwards") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess if the clock got skewed, this might panic the databend instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use this in multi place in data bend. resolve it as another issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok to me, we may replace it with a default value on Err to replace the expect
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
related issue #4354
add /v1/status which return
running_queries_count, last_query_started_at, last_query_finished_at
, may add other fields later.to make it lightweight, maintain the info in sessionManager and update on each query start/finish.
to ignore queries issued by admin api, change session type from string to enum. making it more useful.
Changelog
Related Issues
Fixes #4354
Test Plan
Unit Tests
Stateless Tests