Add Kafka source observability metrics - #7102
Conversation
✅ License Header Check PassedAll newly added files have proper license headers. Great work! 🎉 |
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit e570ebc. ⛔ Hard block: Issues at High severity or above will block this PR from merging.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍(Review updated until commit e570ebc)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to e570ebc Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit c6e3766
Suggestions up to commit 249e04a
|
249e04a to
c6e3766
Compare
|
Persistent review updated to latest commit c6e3766 |
Add metrics to the Kafka source, published through the existing Micrometer registry, so operators can diagnose scaling and reliability issues that were previously visible only in logs, or not at all: - Scaling: per-partition lag, assigned partitions, active readers, and configured workers, so a bottleneck can be seen as partition-bound vs worker-bound. - Rebalance activity: rebalance and partitions-revoked counts. - Processing latency: poll to buffer handoff. - Federated auth (azure_federated): token-refresh success and failure counts (failures tagged by a bounded errorType), and headroom in seconds to the next proactive token refresh. The failure-handling counters from the issue (commit failures, buffer write failures, offset-reset failures) are intentionally left out here; they are covered by opensearch-project#7088. Because the azure_federated callback handler is created reflectively by kafka-clients, its metrics object is handed off through a singleton (KafkaSourceAuthMetricsProvider), mirroring AwsCredentialsSupplierProvider, and is registered only for azure_federated sources. Also make the azure_federated auth failure logging generic and actionable: log the underlying exception with its stack trace instead of asserting a single presumed cause, and drop the SENSITIVE marker from messages whose arguments are not credentials. Resolves opensearch-project#7074 Signed-off-by: Nikhil Bagmar <nikhilbagmar73@gmail.com>
c6e3766 to
e570ebc
Compare
|
Persistent review updated to latest commit e570ebc |
Intentional. The SENSITIVE marker only masks |
1. Refresh deadline — not a bug. 2. Per-partition gauges — bounded, intentional. Cardinality is capped by partition count; 3. Auth metrics are source-scoped by design. Token refresh is per-source, not per-topic, so one object is correct. Last-writer-wins across two federated sources in |
Description
Add metrics to the Kafka source, published through the existing Micrometer registry, so operators can diagnose scaling and reliability issues that were previously visible only in logs, or not at all:
The failure-handling counters from the issue (commit failures, buffer write failures, offset-reset failures) are intentionally left out here; they are covered by #7088.
Because the azure_federated callback handler is created reflectively by kafka-clients, its metrics object is handed off through a singleton (KafkaSourceAuthMetricsProvider), mirroring AwsCredentialsSupplierProvider, and is registered only for azure_federated sources.
Also make the azure_federated auth failure logging generic and actionable: log the underlying exception with its stack trace instead of asserting a single presumed cause, and drop the SENSITIVE marker from messages whose arguments are not credentials.
Issues Resolved
Resolves #7074
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check
here.