This adds prefixes to our error! tracing logs on the identity service
Depends on D11831
Paths
| Differential D11852 Authored by will on May 1 2024, 8:03 PM.
Tags None Referenced Files
Details
Summary This adds prefixes to our error! tracing logs on the identity service Depends on D11831 Test Plan cargo check
Diff Detail
Event TimelineHerald added subscribers: tomek, ashoat. · View Herald TranscriptMay 1 2024, 8:03 PM2024-05-01 20:03:33 (UTC-7) Harbormaster completed remote builds in B28618: Diff 39725.May 1 2024, 8:20 PM2024-05-01 20:20:44 (UTC-7) Comment Actions I was imagining that all the prefixes (e.g. DB Error) would be defined in a module in constants.rs and then used like this: pub const DB_ERROR_LOG_PREFIX: &str = "DB Error"; error!(DB_ERROR_LOG_PREFIX, "Encountered an unexpected error: {}", e); This revision now requires changes to proceed.May 2 2024, 11:28 AM2024-05-02 11:28:58 (UTC-7) Comment Actions
So that would look something like this on output: {"message":"Encountered an unexpected error: e","DB_ERROR_LOG_PREFIX":"DB Error"} Currently my alarms match on the message field. I think it overcomplicates the cloudwatch patterns if we're accessing each possible prefix variable name so what might be best is each error log specifies some field: error!(errorType=DB_ERROR_LOG_PREFIX, "Encountered an unexpected error: {}", e); would get us: {"message":"Encountered an unexpected error: e", "errorType":"DB Error"} I thought about how we'd be able to store the key value "errorType = DB_ERROR_LOG_PREFIX" in our const file so we wouldn't have to include errorType each time, but I don't think it's possible unless we do something really hacky with mods Another option is a new error log helper function? Comment Actions @varun's concern is valid to me. I like the errorType = ... approach.
I think including errorType in each log is okay for now. If this gets too annoying, we can think about creating a custom error! macro Harbormaster completed remote builds in B28716: Diff 39870.May 6 2024, 12:45 PM2024-05-06 12:45:33 (UTC-7)
Harbormaster completed remote builds in B28736: Diff 39894.May 7 2024, 8:19 AM2024-05-07 08:19:30 (UTC-7) This revision is now accepted and ready to land.May 7 2024, 9:47 AM2024-05-07 09:47:10 (UTC-7) Closed by commit rCOMM6190b986ef59: [identity] Add prefixes to error logs for filtering (authored by will). · Explain WhyMay 8 2024, 10:33 AM2024-05-08 10:33:44 (UTC-7) This revision was automatically updated to reflect the committed changes. will marked an inline comment as done.
Revision Contents
Diff 39894 services/identity/src/client_service.rs
services/identity/src/constants.rs
services/identity/src/database.rs
services/identity/src/database/device_list.rs
|