Skip to content

[CT-40] Add consistent metrics instrumentation across all handlers #945

Description

@mftee

Overview

MetricsRegistry (increment_request_count, increment_cache_hits/misses, increment_error_count) is actively used inside verify_document and batch_verify_documents, but submit_document, revoke_document, and record_transfer never call increment_request_count(), and record_transfer only increments error_count on failure paths, never request_count on the happy path. /metrics currently undercounts real traffic.

File

contract/src/lib.rs (submit_document, revoke_document, record_transfer, and CT-31/CT-32's implementations)

Acceptance Criteria

  • Every handler calls metrics.increment_request_count() at the start of its logic
  • Every handler's error paths call metrics.increment_error_count()
  • Consider adding a per-route counter label (or a new metric) so /metrics can distinguish verify vs submit vs revoke vs transfer volume, not just a single global counter
  • Add a test asserting the metrics output includes nonzero counts after exercising each endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions