Skip to content

Add Prometheus metrics to API Server and Indexer #205

@dhyaniarun1993

Description

@dhyaniarun1993

Description

Currently only the Relayer has Prometheus instrumentation. The API Server and Indexer expose /health but have no /metrics endpoint and no application-level metrics.

Suggested metrics for API Server:

  • api_requests_total (counter, labels: method, endpoint, status)
  • api_request_duration_seconds (histogram, labels: method, endpoint)
  • api_active_connections (gauge)
  • api_canton_rpc_duration_seconds (histogram — time spent calling Canton ledger)
  • api_eth_rpc_requests_total (counter, labels: method, status)

Suggested metrics for Indexer:

  • indexer_events_processed_total (counter, labels: event_type)
  • indexer_sync_lag_seconds (gauge — how far behind the ledger)
  • indexer_last_offset (gauge — last processed ledger offset)
  • indexer_db_query_duration_seconds (histogram, labels: query)

Scope:

  • Add Monitoring config section to API Server and Indexer configs
  • Register promhttp.Handler() on each service
  • Add middleware for HTTP request metrics (chi middleware or custom)
  • Update Prometheus scrape config to include all three services
  • Add metrics definitions in dedicated files or extend metrics

Acceptance Criteria:

  • API Server(including Indexer) each expose /metrics
  • Prometheus scrape config includes all three services
  • Config files updated with monitoring section

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementAdded to issues and PRs when a change includes improvements or optimizations.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions