Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imbolc/tower-request-id
A tower (hyper, axum, warp) service to add an unique id for every request
https://github.com/imbolc/tower-request-id
rust tokio-rs web
Last synced: 2 months ago
JSON representation
A tower (hyper, axum, warp) service to add an unique id for every request
- Host: GitHub
- URL: https://github.com/imbolc/tower-request-id
- Owner: imbolc
- Created: 2021-09-29T07:17:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-02T10:40:56.000Z (about 1 year ago)
- Last Synced: 2024-04-14T15:14:18.092Z (9 months ago)
- Topics: rust, tokio-rs, web
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 24
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![License](https://img.shields.io/crates/l/tower-request-id.svg)](https://choosealicense.com/licenses/mit/)
[![Crates.io](https://img.shields.io/crates/v/tower-request-id.svg)](https://crates.io/crates/tower-request-id)
[![Docs.rs](https://docs.rs/tower-request-id/badge.svg)](https://docs.rs/tower-request-id)# tower-request-id
A tiny [tower] ([hyper], [axum], [warp] etc) service to generate a random id for each
incoming request.## Usage
After adding the [`RequestIdLayer`] into the [axum] middlewares the request id is available in
the [`http::Request::extensions()`]. For the [tracing] integration, please refer to the
[logging example].[tower]: https://crates.io/crates/tower
[hyper]: https://crates.io/crates/hyper
[axum]: https://crates.io/crates/axum
[warp]: https://crates.io/crates/warp
[tracing]: https://crates.io/crates/tracing
[`Request.extensions()`]: https://docs.rs/http/0.2.5/http/request/struct.Request.html#method.extensions
[logging example]: https://github.com/imbolc/tower-request-id/blob/main/examples/logging.rs## Contributing
We appreciate all kinds of contributions, thank you!
### Note on README
Most of the readme is automatically copied from the crate documentation by [cargo-sync-readme][].
This way the readme is always in sync with the docs and examples are tested.So if you find a part of the readme you'd like to change between ``
and `` markers, don't edit `README.md` directly, but rather change
the documentation on top of `src/lib.rs` and then synchronize the readme with:
```bash
cargo sync-readme
```
(make sure the cargo command is installed):
```bash
cargo install cargo-sync-readme
```If you have [rusty-hook] installed the changes will apply automatically on commit.
## License
This project is licensed under the [MIT license](LICENSE).
[cargo-sync-readme]: https://github.com/phaazon/cargo-sync-readme
[rusty-hook]: https://github.com/swellaby/rusty-hook