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

feature: add metrics/tracking to remaining agents #922

Merged
merged 7 commits into from
Nov 1, 2021

Conversation

luketchang
Copy link
Contributor

@luketchang luketchang commented Oct 30, 2021

Bad dependency but running this in prod is contingent on testing previous updater PR in dev first...

For #917

@luketchang luketchang added rust 🦀 Rust dev work required agents Relating to rust agents labels Oct 30, 2021
@luketchang luketchang self-assigned this Oct 30, 2021
@luketchang luketchang marked this pull request as ready for review October 30, 2021 22:41
@luketchang luketchang requested a review from emberian as a code owner October 30, 2021 22:41
@luketchang luketchang changed the title WIP: add metrics/tracking to remaining agents feature: add metrics/tracking to remaining agents Oct 30, 2021
Comment on lines 76 to 78
.db
.retrieve_latest_nonce(domain)?
.retrieve_keyed_decodable(CURRENT_NONCE, &replica_domain)?
.map(|n: u32| n + 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trying to remove pass through methods in OpticsDB. Also felt that simple agent-unique counter stores didn't belong in OpticsDB so we just use basic db methods here

// Relay update and increment counters if tx successful
if self.replica.update(&signed_update).await.is_ok() {
self.updates_relayed_count
.with_label_values(&[self.home.name(), self.replica.name(), AGENT_NAME])
Copy link
Contributor

Choose a reason for hiding this comment

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

this invocation is constant for every instance of UpdatePoller, which is why in the other PR i made for just the updater stores an already-fully-specified IntCounter inside the UpdatePoller instead of doing it dynamically.

doing so only avoids a single hash of all the labels, though, so 🤷🏼

@@ -140,7 +172,8 @@ impl OpticsAgent for Relayer {
}
let replica = replica_opt.unwrap();

let update_poller = UpdatePoller::new(home, replica.clone(), duration);
let update_poller =
UpdatePoller::new(home, replica.clone(), duration, updates_relayed_count);
Copy link
Contributor

Choose a reason for hiding this comment

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

all the information needed to do updates_relayed_count.with_label_values is right here

@luketchang luketchang merged commit f007a29 into main Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents Relating to rust agents rust 🦀 Rust dev work required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants