-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Serve some basic config info at /info. #14842
Conversation
⏱️ 4h 45m total CI duration on this PR
|
253bae3
to
f62bf1d
Compare
api/src/basic.rs
Outdated
self.context.node_config.indexer_db_config | ||
)); | ||
|
||
Html(rows.join("\n")) |
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.
Any reason not to send outputs as a map? It is JSON
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 did whatever chatgpt told me to do.
Changed to use map now.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Please generate the new OpenAPI spec. Cc @banool
api/src/basic.rs
Outdated
operation_id = "info", | ||
tag = "ApiTags::General" | ||
)] | ||
async fn info(&self) -> Json<HashMap<String, String>> { |
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.
Will it be a breaking change if later we change this to a nested structure?
(How does it look like in the API spec?)
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.
Generated the spec, PTAL
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.
Looks like it just says "json in text" (so we are good)?
But can an expert confirm? 😂 @banool ?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
format!("{:?}", self.context.node_config.indexer_db_config), | ||
); | ||
|
||
Json(info) |
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 suppose this is intended only for human consumption, hence the keys like "Internal Indexer Config" rather than internal_indexer_config
?
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.
Yes that's what I'm expecting. Changed to snake_case anyway.
api/src/basic.rs
Outdated
operation_id = "info", | ||
tag = "ApiTags::General" | ||
)] | ||
async fn info(&self) -> Json<HashMap<String, String>> { |
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.
This output will be more standard and parseable if you just use JSON values. How about you instead use:
Json<HashMap<String, serde_json::Value>>
as the output?
As it is now you're using the debug representation inside a string, so that will be difficult to parse. Like it'll look sort of like JSON but not quite.
So instead of:
format!(
"{:?}",
self.context
.node_config
.state_sync
.state_sync_driver
.bootstrapping_mode
),
Do this:
serde_json::Value::from(&self.context
.node_config
.state_sync
.state_sync_driver
.bootstrapping_mode)
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.
Even better, you could also just return Json<HashMap<String, T>>
where T: Serialize
and then poem will do the serialization for you I think.
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.
Done
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Looks like you need to regenerate the specs: https://github.com/aptos-labs/aptos-core/actions/runs/11281767450/job/31378312630?pr=14842.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
As discussed, serve some basic config under /v1/info. We can add more later.
How Has This Been Tested?
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist