Skip to content

Conversation

@eudelins-zama
Copy link
Contributor

@eudelins-zama eudelins-zama commented Dec 5, 2025

Closes https://github.com/zama-ai/fhevm-internal/issues/721

Some examples extracted for a local e2e tests run:

Screenshot From 2025-12-05 11-14-47 Screenshot From 2025-12-05 11-23-13 Screenshot From 2025-12-05 11-24-17 Screenshot From 2025-12-05 11-25-16

@eudelins-zama eudelins-zama self-assigned this Dec 5, 2025
@cla-bot cla-bot bot added the cla-signed label Dec 5, 2025
Copilot finished reviewing on behalf of eudelins-zama December 5, 2025 08:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements more granular Prometheus metrics for the kms-connector by adding labels to distinguish between different event and response types. Previously, metrics aggregated all types together; now they're broken down by event type (public_decryption_request, user_decryption_request, etc.) and response type.

Key Changes:

  • Converted all metrics from IntCounter to IntCounterVec with event_type or response_type labels
  • Added new gauge metrics for tracking pending events and responses in the database
  • Consolidated and renamed kms-worker metrics (decryption/key_management → grpc)
  • Added as_str() methods to EventType and KmsResponseKind for consistent label values

Reviewed changes

Copilot reviewed 14 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
kms-connector/crates/tx-sender/src/monitoring/metrics.rs Converted counters to counter vecs with labels; added new gauge metrics with background update job
kms-connector/crates/tx-sender/src/core/tx_sender.rs Updated metric calls to use label values from response.as_str()
kms-connector/crates/tx-sender/src/core/kms_response_picker/picker.rs Updated metric calls to use label values from notification
kms-connector/crates/tx-sender/src/core/kms_response_picker/notifier.rs Added response_str() method and Display implementation for consistent labeling
kms-connector/crates/kms-worker/src/monitoring/metrics.rs Consolidated and renamed metrics; converted to counter vecs with event type labels
kms-connector/crates/kms-worker/src/core/event_processor/kms_client.rs Updated all gRPC request/response metric calls to use EventType for labeling
kms-connector/crates/kms-worker/src/core/event_picker/picker.rs Replaced EventNotification enum with EventType; updated metric calls
kms-connector/crates/kms-worker/src/core/event_picker/notifier.rs Removed EventNotification enum; now uses EventType from utils crate
kms-connector/crates/gw-listener/src/monitoring/metrics.rs Converted counters to counter vecs; removed EVENT_STORED_COUNTER and EVENT_STORAGE_ERRORS
kms-connector/crates/gw-listener/src/core/gw_listener.rs Updated metric calls with labels; removed EVENT_STORAGE_ERRORS increment
kms-connector/crates/gw-listener/src/core/publish.rs Removed EVENT_STORED_COUNTER increment
kms-connector/crates/utils/src/types/kms_response.rs Added as_str() method and constants for response type labels
kms-connector/crates/utils/src/types/db.rs Added TryFrom<PgNotification>, pg_notification(), and as_str() methods for EventType; defined notification constants
kms-connector/Cargo.toml Updated fhevm_gateway_bindings from v0.10.0-2 to v0.10.0
kms-connector/Cargo.lock Updated fhevm_gateway_bindings dependency reference
kms-connector/.sqlx/*.json Added sqlx offline compilation cache files for new database queries
Files not reviewed (4)
  • kms-connector/.sqlx/query-05f22646520c5835fc3235aa6378dccd4436ca4a07ab25a9c8abe21760d5b202.json: Language not supported
  • kms-connector/.sqlx/query-17db0e005e1367157721bf62877d735a9fb755f5d9afe72f069a1872ff1b7fd6.json: Language not supported
  • kms-connector/.sqlx/query-a70444056f27bd68660c86bade10eccfac9cb5fd677de32dcc7bea043d3ca237.json: Language not supported
  • kms-connector/.sqlx/query-f4cec78c0611edc0cf747320db7f0fb1c9eaec89303c3f3e45617b155fa9aed8.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eudelins-zama eudelins-zama force-pushed the eudelins/chore/721/granular-metrics branch from ddffd24 to c837960 Compare December 5, 2025 08:43
@eudelins-zama eudelins-zama requested a review from Copilot December 5, 2025 08:44
Copilot finished reviewing on behalf of eudelins-zama December 5, 2025 08:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 19 changed files in this pull request and generated 4 comments.

Files not reviewed (4)
  • kms-connector/.sqlx/query-05f22646520c5835fc3235aa6378dccd4436ca4a07ab25a9c8abe21760d5b202.json: Language not supported
  • kms-connector/.sqlx/query-17db0e005e1367157721bf62877d735a9fb755f5d9afe72f069a1872ff1b7fd6.json: Language not supported
  • kms-connector/.sqlx/query-a70444056f27bd68660c86bade10eccfac9cb5fd677de32dcc7bea043d3ca237.json: Language not supported
  • kms-connector/.sqlx/query-f4cec78c0611edc0cf747320db7f0fb1c9eaec89303c3f3e45617b155fa9aed8.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eudelins-zama eudelins-zama force-pushed the eudelins/chore/721/granular-metrics branch 2 times, most recently from dbb0409 to 74c9a38 Compare December 5, 2025 09:02
@eudelins-zama eudelins-zama requested a review from Copilot December 5, 2025 09:03
@eudelins-zama eudelins-zama force-pushed the eudelins/chore/721/granular-metrics branch from 74c9a38 to 345a971 Compare December 5, 2025 09:04
Copilot finished reviewing on behalf of eudelins-zama December 5, 2025 09:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 24 changed files in this pull request and generated 1 comment.

Files not reviewed (4)
  • kms-connector/.sqlx/query-05f22646520c5835fc3235aa6378dccd4436ca4a07ab25a9c8abe21760d5b202.json: Language not supported
  • kms-connector/.sqlx/query-17db0e005e1367157721bf62877d735a9fb755f5d9afe72f069a1872ff1b7fd6.json: Language not supported
  • kms-connector/.sqlx/query-a70444056f27bd68660c86bade10eccfac9cb5fd677de32dcc7bea043d3ca237.json: Language not supported
  • kms-connector/.sqlx/query-f4cec78c0611edc0cf747320db7f0fb1c9eaec89303c3f3e45617b155fa9aed8.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eudelins-zama eudelins-zama marked this pull request as ready for review December 5, 2025 10:26
@eudelins-zama eudelins-zama requested review from a team as code owners December 5, 2025 10:26
@eudelins-zama eudelins-zama force-pushed the eudelins/chore/721/granular-metrics branch from 8a4cd6d to 4018fc9 Compare December 5, 2025 11:10
Copy link
Collaborator

@dartdart26 dartdart26 left a comment

Choose a reason for hiding this comment

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

Looks good!

@eudelins-zama
Copy link
Contributor Author

@Mergifyio queue

@mergify
Copy link

mergify bot commented Dec 5, 2025

queue

🟠 Waiting for conditions to match

  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue main]
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
      • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
      • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
      • base = main
      • label!=do-not-merge
      • any of: [🛡 GitHub branch protection]
        • check-success = common-pull-request/lint (bpr)
        • check-neutral = common-pull-request/lint (bpr)
        • check-skipped = common-pull-request/lint (bpr)
      • any of: [🛡 GitHub branch protection]
        • check-skipped = coprocessor-cargo-listener-tests/cargo-tests (bpr)
        • check-neutral = coprocessor-cargo-listener-tests/cargo-tests (bpr)
        • check-success = coprocessor-cargo-listener-tests/cargo-tests (bpr)
      • any of: [🛡 GitHub branch protection]
        • check-skipped = coprocessor-cargo-test/cargo-tests (bpr)
        • check-neutral = coprocessor-cargo-test/cargo-tests (bpr)
        • check-success = coprocessor-cargo-test/cargo-tests (bpr)
      • any of: [🛡 GitHub branch protection]
        • check-skipped = coprocessor-dependency-analysis/dependencies-check (bpr)
        • check-neutral = coprocessor-dependency-analysis/dependencies-check (bpr)
        • check-success = coprocessor-dependency-analysis/dependencies-check (bpr)
      • any of: [🛡 GitHub branch protection]
        • check-skipped = gateway-contracts-deployment-tests/sc-deploy (bpr)
        • check-neutral = gateway-contracts-deployment-tests/sc-deploy (bpr)
        • check-success = gateway-contracts-deployment-tests/sc-deploy (bpr)
      • any of: [🛡 GitHub branch protection]
        • check-success = kms-connector-tests/test-connector (bpr)
        • check-neutral = kms-connector-tests/test-connector (bpr)
        • check-skipped = kms-connector-tests/test-connector (bpr)
  • -closed [📌 queue requirement]
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of: [📌 queue -> configuration change requirements]
    • -mergify-configuration-changed
    • check-success = Configuration changed

@mergify
Copy link

mergify bot commented Dec 5, 2025

Merge Queue Status

🟠 Waiting for queue conditions

Required conditions to enter a queue
  • any of [🔀 queue conditions]:
    • all of [📌 queue conditions of queue main]:
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
      • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
      • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
      • base = main
      • label!=do-not-merge
      • any of [🛡 GitHub branch protection]:
        • check-success = common-pull-request/lint (bpr)
        • check-neutral = common-pull-request/lint (bpr)
        • check-skipped = common-pull-request/lint (bpr)
      • any of [🛡 GitHub branch protection]:
        • check-skipped = coprocessor-cargo-listener-tests/cargo-tests (bpr)
        • check-neutral = coprocessor-cargo-listener-tests/cargo-tests (bpr)
        • check-success = coprocessor-cargo-listener-tests/cargo-tests (bpr)
      • any of [🛡 GitHub branch protection]:
        • check-skipped = coprocessor-cargo-test/cargo-tests (bpr)
        • check-neutral = coprocessor-cargo-test/cargo-tests (bpr)
        • check-success = coprocessor-cargo-test/cargo-tests (bpr)
      • any of [🛡 GitHub branch protection]:
        • check-skipped = coprocessor-dependency-analysis/dependencies-check (bpr)
        • check-neutral = coprocessor-dependency-analysis/dependencies-check (bpr)
        • check-success = coprocessor-dependency-analysis/dependencies-check (bpr)
      • any of [🛡 GitHub branch protection]:
        • check-skipped = gateway-contracts-deployment-tests/sc-deploy (bpr)
        • check-neutral = gateway-contracts-deployment-tests/sc-deploy (bpr)
        • check-success = gateway-contracts-deployment-tests/sc-deploy (bpr)
      • any of [🛡 GitHub branch protection]:
        • check-success = kms-connector-tests/test-connector (bpr)
        • check-neutral = kms-connector-tests/test-connector (bpr)
        • check-skipped = kms-connector-tests/test-connector (bpr)
  • -closed [📌 queue requirement]
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of [📌 queue -> configuration change requirements]:
    • -mergify-configuration-changed
    • check-success = Configuration changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants