Skip to content
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

Review and fix HTTP metrics recording for handling all error #1327

Open
noise64 opened this issue Feb 18, 2025 · 0 comments
Open

Review and fix HTTP metrics recording for handling all error #1327

noise64 opened this issue Feb 18, 2025 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@noise64
Copy link
Contributor

noise64 commented Feb 18, 2025

It seems that many places uses this pattern:

let record = recorded_http_api_request!("endpoint name", id = id);
let response = {
    let result = xyz_service
            .operation(...)
            .await?; // (1)
            // (2) sometimes using _some_ explicit error mapping here, like mapping empty collections to 404
    Ok(Json(result))
};

record.result(response)

Unfortunately this does not record any errors happening at (1), only explicit ones done at (2).
To make this work this either should use "IIFE" closures (as other similar feature is not yet available in stabile rust), or most probably we should just follow how this is handled in GRPC endpoints.

@vigoo vigoo added this to the Golem 1.2 milestone Feb 19, 2025
@vigoo vigoo added the bug Something isn't working label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants