Skip to content

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

@noise64

Description

@noise64

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions