#axum-server #http-header #response-headers #web-server #server-response

axum-server-timing

An axum layer to inject the Server-Timing HTTP header into the response

7 releases (3 stable)

2.0.0 Jan 1, 2025
1.0.1 Aug 19, 2024
1.0.0 Jul 23, 2024
0.3.1 Mar 25, 2024
0.1.0 Apr 19, 2023

#175 in HTTP server

Download history 432/week @ 2024-11-22 389/week @ 2024-11-29 436/week @ 2024-12-06 398/week @ 2024-12-13 665/week @ 2024-12-20 893/week @ 2024-12-27 796/week @ 2025-01-03 707/week @ 2025-01-10 554/week @ 2025-01-17 540/week @ 2025-01-24 830/week @ 2025-01-31 409/week @ 2025-02-07 465/week @ 2025-02-14 668/week @ 2025-02-21 1022/week @ 2025-02-28 585/week @ 2025-03-07

2,836 downloads per month

MIT/Apache

20KB
191 lines

axum-server-timing

Latest Version

An axum layer to inject the Server-Timing HTTP header into the response.

For a reference on the header please see developer.mozilla.org.

Examples

Using the layer to inject the Server-Timing Header.

    let app = Router::new()
        .route("/", get(handler))
        .layer(axum_server_timing::ServerTimingLayer::new("HelloService"));

Output

HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;dur=102
date: Wed, 19 Apr 2023 15:25:40 GMT

<h1>Hello, World!</h1>

Using the layer to inject the Server-Timing Header with description.

    let app = Router::new()
        .route("/", get(handler))
        .layer(
        axum_server_timing::ServerTimingLayer::new("HelloService")
            .with_description("whatever")
        );

Output

HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;desc="whatever";dur=102
date: Wed, 19 Apr 2023 15:25:40 GMT

<h1>Hello, World!</h1>

Dependencies

~5–11MB
~111K SLoC