aptos-core
aptos-core copied to clipboard
[API] Improve metrics, documentation, linting
Summary
This PR makes various improvements to metrics (per-endpoint logging), docs, spec generation (a new standalone binary), deduplication, and linting (to ensure spec changes are checked in).
I can make the failpoint stuff middleware as well once https://github.com/poem-web/poem/issues/351 goes in.
Test plan
cargo nextest run --package smoke-test --test-threads 8
@rajkaramchedu, for when you look at this next week, a quick guide. With the new API, the spec is generated from the code, vs them being separately written by hand. As such, all the documentation, examples, etc. exist alongside the relevant code (the endpoint handlers, the types, etc).
Some relevant paths include:
api/src/poem_backend/, particularly the endpoint files, likeevents.rs,transactions.rs, etc. In those you'll see large comments above functions likesubmit_transaction; those are what end up in the spec.api/types/src/, particularly types inderives.rs.
If you want to play around with it, the flow is:
- Change code, e.g. the comments above an endpoint handler function
- Run the following command from the root of the repo to get a spec out:
cargo run -p aptos-openapi-spec-generator -- -f yaml -o api/doc/v1/spec.yaml
Now that I write this up, I realize this should itself be in the README. As you can see, I haven't filled it in yet for v1 of the API: api/docs/v1/README.md.
@rajkaramchedu I keep running into merge conflicts because things keep changing around this PR, and even more so its child PR here: https://github.com/aptos-labs/aptos-core/pull/2333. I'm going to land this and we can make any docs changes in another PR.
:white_check_mark: Forge test success on 6ebafc774f94fb22e3941bc2a020519ae26774a7
all up : 5066 TPS, 2177 ms latency, 2950 ms p99 latency,no expired txns
- Grafana dashboard
- Validator 0 logs
- Humio Logs
- Test runner output
- Test run 1 is land-blocking