Skip to content

kms: add Prometheus metrics endpoint#657

Merged
kvinwang merged 3 commits intomasterfrom
feat/kms-metrics-api
Apr 30, 2026
Merged

kms: add Prometheus metrics endpoint#657
kvinwang merged 3 commits intomasterfrom
feat/kms-metrics-api

Conversation

@kvinwang
Copy link
Copy Markdown
Collaborator

Summary

  • add GET /metrics to dstack-kms in Prometheus text format
  • expose dstack_kms_attestation_requests_total and dstack_kms_attestation_failures_total counters
  • count attestation RPCs through a Rocket response fairing so pre-handler failures are included

Test

  • rustfmt --edition 2021 --check kms/src/main.rs kms/src/main_service.rs
  • cargo check -p dstack-kms

Copilot AI review requested due to automatic review settings April 30, 2026 01:51
Copy link
Copy Markdown
Contributor

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

Adds a Prometheus-compatible metrics endpoint to the dstack-kms Rocket service and instruments attestation-related pRPC calls with in-process counters.

Changes:

  • Add KmsMetrics counters to KmsState and a Prometheus text renderer.
  • Expose GET /metrics returning Prometheus text format.
  • Record attestation request/failure counts via a Rocket on_response fairing to include pre-handler failures.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
kms/src/main_service.rs Introduces KmsMetrics in shared state and renders Prometheus exposition text.
kms/src/main.rs Adds /metrics route and a response fairing to record attestation metrics for selected pRPC methods.

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

Comment thread kms/src/main_service.rs
Comment thread kms/src/main.rs
@kvinwang kvinwang merged commit 20dc37e into master Apr 30, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants