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

Add metrics for serial id and event time #547

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deploy/stage/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.8.25"
image: "ghcr.io/worldcoin/iris-mpc:v0.8.26"

environment: stage
replicaCount: 1
Expand Down
17 changes: 17 additions & 0 deletions deploy/stage/smpcv2-0-stage/values-iris-mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ env:
- name: SMPC__MAX_BATCH_SIZE
value: "64"

- name: SMPC__SERVICE__METRICS__HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP

- name: SMPC__SERVICE__METRICS__PORT
value: "8125"

- name: SMPC__SERVICE__METRICS__QUEUE_SIZE
value: "5000"

- name: SMPC__SERVICE__METRICS__BUFFER_SIZE
value: "1024"

- name: SMPC__SERVICE__METRICS__PREFIX
value: "smpcv2-0"

initContainer:
enabled: true
image: "amazon/aws-cli:2.17.62"
Expand Down
17 changes: 17 additions & 0 deletions deploy/stage/smpcv2-1-stage/values-iris-mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ env:
- name: SMPC__MAX_BATCH_SIZE
value: "64"

- name: SMPC__SERVICE__METRICS__HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP

- name: SMPC__SERVICE__METRICS__PORT
value: "8125"

- name: SMPC__SERVICE__METRICS__QUEUE_SIZE
value: "5000"

- name: SMPC__SERVICE__METRICS__BUFFER_SIZE
value: "1024"

- name: SMPC__SERVICE__METRICS__PREFIX
value: "smpcv2-1"

initContainer:
enabled: true
image: "amazon/aws-cli:2.17.62"
Expand Down
17 changes: 17 additions & 0 deletions deploy/stage/smpcv2-2-stage/values-iris-mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ env:
- name: SMPC__MAX_BATCH_SIZE
value: "64"

- name: SMPC__SERVICE__METRICS__HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP

- name: SMPC__SERVICE__METRICS__PORT
value: "8125"

- name: SMPC__SERVICE__METRICS__QUEUE_SIZE
value: "5000"

- name: SMPC__SERVICE__METRICS__BUFFER_SIZE
value: "1024"

- name: SMPC__SERVICE__METRICS__PREFIX
value: "smpcv2-2"

initContainer:
enabled: true
image: "amazon/aws-cli:2.17.62"
Expand Down
2 changes: 2 additions & 0 deletions iris-mpc-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ serde_json.workspace = true
sodiumoxide = "0.2.7"
iris-mpc-common = { path = "../iris-mpc-common" }
base64 = "0.22.1"
metrics = "0.22.1"
metrics-exporter-statsd = "0.7"

[dev-dependencies]
criterion = "0.5"
Expand Down
18 changes: 12 additions & 6 deletions iris-mpc-gpu/src/server/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,20 +883,26 @@ impl ServerActor {

// ---- END RESULT PROCESSING ----
log_timers(events);

let processed_mil_elements_per_second = (self.max_batch_size * previous_total_db_size)
as f64
/ now.elapsed().as_secs_f64()
/ 1e6;
tracing::info!(
"Batch took {:?} [{:.2} Melems/s]",
now.elapsed(),
(self.max_batch_size * previous_total_db_size) as f64
/ now.elapsed().as_secs_f64()
/ 1e6
processed_mil_elements_per_second
);

metrics::histogram!("processed_melems_per_second")
.record(processed_mil_elements_per_second);

let new_db_size = self.current_db_sizes.iter().sum::<usize>();
tracing::info!(
"Old DB size: {}, New DB size: {}",
previous_total_db_size,
self.current_db_sizes.iter().sum::<usize>()
new_db_size
);
metrics::gauge!("db_size").set(new_db_size as f64);

Ok(())
}
Expand Down Expand Up @@ -1277,7 +1283,7 @@ fn log_timers(events: HashMap<&str, Vec<Vec<CUevent>>>) {
.sum();

tracing::info!("Event {}: {:?} ms", name, duration);
// TODO: send to metrics
metrics::histogram!("event_duration", "event_name" => name.to_string()).record(duration);
}
}

Expand Down
2 changes: 2 additions & 0 deletions iris-mpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ iris-mpc-gpu = { path = "../iris-mpc-gpu" }
iris-mpc-common = { path = "../iris-mpc-common" }
iris-mpc-store = { path = "../iris-mpc-store" }
sha2 = "0.10.8"
metrics = "0.22.1"
metrics-exporter-statsd = "0.7"

[dev-dependencies]
criterion = "0.5"
Expand Down
5 changes: 5 additions & 0 deletions iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,11 @@ async fn server_main(config: Config) -> eyre::Result<()> {

tx.commit().await?;

for memory_serial_id in memory_serial_ids {
tracing::info!("Inserted serial_id: {}", memory_serial_id);
metrics::gauge!("results_inserted.latest_serial_id").set(memory_serial_id as f64);
}

tracing::info!("Sending {} uniqueness results", uniqueness_results.len());
send_results_to_sns(
uniqueness_results,
Expand Down
Loading