Skip to content

[improve][pip] PIP-441: Add Broker-Level Metrics for Skipped Non-Recoverable Data - #24716

Merged
lhotari merged 3 commits into
apache:masterfrom
codelipenghui:pip-441-broker-metrics-non-recoverable-data
Oct 1, 2026
Merged

lhotari merged 3 commits into
apache:masterfrom
codelipenghui:pip-441-broker-metrics-non-recoverable-data

Conversation

@codelipenghui

@codelipenghui codelipenghui commented Sep 8, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This PIP proposes adding two broker-level metrics to provide essential visibility into non-recoverable data skipping when autoSkipNonRecoverableData is enabled.

New Metrics

  • pulsar_broker_non_recoverable_ledgers_skipped_total - Count of entire ledgers skipped
  • pulsar_broker_non_recoverable_entries_skipped_total - Count of individual entries skipped

Motivation

Currently, there is no visibility when Pulsar skips non-recoverable data during disaster recovery scenarios. This creates operational blind spots where:

  • Operators cannot be alerted when data loss occurs
  • No audit trail exists for compliance requirements
  • Cannot distinguish between healthy systems and those silently losing data
  • Unable to determine if issues are systematic (ledger-level) or localized (entry-level)

Implementation

  • Adds counters to BrokerOperabilityMetrics class
  • Integrates with existing skip methods:
    • ManagedLedgerImpl.skipNonRecoverableLedger() → ledger metric
    • ManagedCursorImpl.skipNonRecoverableEntries() → entry metric
  • Supports both Prometheus and OpenTelemetry formats
  • Broker-level approach avoids high-cardinality burden on metrics system

Operational Benefits

  • Alerting: Get notified immediately when data loss occurs
  • SLA Monitoring: Track data durability metrics over time
  • Root Cause Analysis: Compare metrics to understand failure patterns
  • Investigation Workflow: Use metrics for alerting, then check broker logs for specific topic details

Design Rationale

  • Broker-level vs Topic-level: Avoids metrics system burden while maintaining essential visibility
  • Two separate metrics: Provides granular insight into different types of data corruption
  • Log-based investigation: Balances alerting capability with detailed forensics

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

…verable Data

This PIP proposes adding two broker-level metrics to provide visibility into
non-recoverable data skipping when autoSkipNonRecoverableData is enabled:

- pulsar_broker_non_recoverable_ledgers_skipped_total: Count of ledgers skipped
- pulsar_broker_non_recoverable_entries_skipped_total: Count of entries skipped

The metrics enable operators to:
- Set up alerts when data loss occurs
- Monitor data durability SLAs
- Distinguish between systematic (ledger-level) vs localized (entry-level) issues
- Use broker logs for detailed investigation of specific topics affected

Implementation adds counters to BrokerOperabilityMetrics with integration points
in ManagedLedgerImpl.skipNonRecoverableLedger() and
ManagedCursorImpl.skipNonRecoverableEntries().

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@codelipenghui codelipenghui self-assigned this Sep 8, 2025
@apache apache deleted a comment from github-actions Bot Sep 8, 2025
@codelipenghui codelipenghui added this to the 4.2.0 milestone Sep 8, 2025
@github-actions github-actions Bot added doc-not-needed Your PR changes do not impact docs PIP and removed doc-label-missing labels Sep 8, 2025
codelipenghui added a commit to codelipenghui/incubator-pulsar that referenced this pull request Sep 10, 2025
This change implements GitHub PR apache#24716 to add operational visibility for non-recoverable data loss events in Apache Pulsar brokers.

Key Changes:
- Add NonRecoverableDataMetricsCallback interface in managed-ledger module
- Integrate callback in ManagedLedgerImpl.skipNonRecoverableLedger()
- Integrate callback in ManagedCursorImpl.skipNonRecoverableEntries()
- Configure callback in BrokerService during managed ledger creation
- Add two new metrics in BrokerOperabilityMetrics:
  - pulsar.broker.non.recoverable.ledgers.skipped.count
  - pulsar.broker.non.recoverable.entries.skipped.count
- Support both Prometheus and OpenTelemetry metrics
- Comprehensive test coverage including end-to-end integration tests

The metrics are always available regardless of ManagedLedgerInterceptor configuration,
providing reliable operational monitoring for data loss scenarios.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Comment thread pip/pip-441.md
Comment thread pip/pip-441.md
@lhotari lhotari modified the milestones: 4.2.0, 4.3.0 Apr 27, 2026
@lhotari lhotari modified the milestones: 5.0.0-M1, 5.0.0 Oct 1, 2026
@lhotari
lhotari merged commit e463d25 into apache:master Oct 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs PIP ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants