Skip to content

feat: Add metrics/instrumentation #28

Description

@tomverelst

Problem

Currently there's no observability beyond logging. Operators have limited visibility into performance and progress during large migrations.

Suggestion

Add metrics using the metrics crate or OpenTelemetry:

Counters

  • kbridge_offsets_processed_total - Number of offsets processed
  • kbridge_partitions_scanned_total - Number of partitions scanned
  • kbridge_binary_search_iterations_total - Binary search iterations performed

Histograms

  • kbridge_operation_duration_seconds - Time per operation (fetch/calculate/apply)
  • kbridge_partition_scan_duration_seconds - Time to scan a partition

Gauges

  • kbridge_pending_offsets - Offsets remaining to process

Example

use metrics::{counter, histogram};

counter!("kbridge_offsets_processed_total").increment(1);
histogram!("kbridge_operation_duration_seconds").record(duration.as_secs_f64());

Impact

Enables monitoring, alerting, and performance analysis for production use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions