Skip to content

Commit

Permalink
proxy: report redis broken message metric (#7021)
Browse files Browse the repository at this point in the history
## Problem

Not really a problem. Improving visibility around redis communication.

## Summary of changes

Added metric on the number of broken messages.
  • Loading branch information
khanova committed Mar 5, 2024
1 parent 270d3be commit bdbb2f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions proxy/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,12 @@ pub static ENDPOINT_ERRORS_BY_KIND: Lazy<HyperLogLogVec<32>> = Lazy::new(|| {
)
.unwrap()
});

pub static REDIS_BROKEN_MESSAGES: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"proxy_redis_errors_total",
"Number of errors by a given classification",
&["channel"],
)
.unwrap()
});
4 changes: 4 additions & 0 deletions proxy/src/redis/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
cache::project_info::ProjectInfoCache,
cancellation::{CancelMap, CancellationHandler, NotificationsCancellationHandler},
intern::{ProjectIdInt, RoleNameInt},
metrics::REDIS_BROKEN_MESSAGES,
};

const CPLANE_CHANNEL_NAME: &str = "neondb-proxy-ws-updates";
Expand Down Expand Up @@ -115,6 +116,9 @@ impl<
let msg: Notification = match serde_json::from_str(&payload) {
Ok(msg) => msg,
Err(e) => {
REDIS_BROKEN_MESSAGES
.with_label_values(&[msg.get_channel_name()])
.inc();
tracing::error!("broken message: {e}");
return Ok(());
}
Expand Down

1 comment on commit bdbb2f4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2567 tests run: 2432 passed, 1 failed, 134 skipped (full report)


Failures on Postgres 14

  • test_basebackup_with_high_slru_count[github-actions-selfhosted-sequential-10-13-30]: release
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_basebackup_with_high_slru_count[release-pg14-github-actions-selfhosted-sequential-10-13-30]"

Code coverage* (full report)

  • functions: 28.8% (6981 of 24243 functions)
  • lines: 47.4% (42872 of 90525 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
bdbb2f4 at 2024-03-05T16:09:08.069Z :recycle:

Please sign in to comment.