Repository navigation
Conversation
… Prometheus registry
…mbedded bookie Main.buildBookieServer() created a second provider from the same configuration, and that one still landed on the 1.x default registry.
…n Prometheus registry BKCluster and LocalBookkeeperEnsemble let EmbeddedServer build the provider, which lands on the default registry the broker's /metrics reads. They now create and own the provider the same way PulsarBrokerStarter does, through a shared BookieStatsProviders helper.
…ava client 1.x The four per-broker collectors become MultiCollectors on PrometheusRegistry, keeping the per-registry sharing, per-cluster aggregation and retirement of counters.
2 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main Issue: #27045
Draft until #27350 is merged. That PR makes the broker
/metricsread the Prometheus Java client 1.x default registry, and the parity test in this PR needs it. The branch carries the #27350 commits until then. This PR does not depend on the otherpulsar-brokerport PRs; they can merge in any order.Motivation
Part of the
pulsar-brokeritem in #27045: the scalable topic metrics inScalableTopicMetrics,ScalableTopicControllerMetrics,ScalableTopicConsumerMetricsandSegmentOwnerMetrics.Modifications
These four classes were custom simpleclient collectors. Each broker has its own instance, but brokers in one JVM that share a registry share one collector, which sums their values per cluster and keeps the totals of brokers that already closed. That design is kept; the collectors are now 1.x
MultiCollectors on aPrometheusRegistry. The first instance on a registry registers the collector, later instances join it, andclose()unregisters it when the last instance leaves.ScalableTopicMetricskeeps an internal, unregistered 1.x histogram for request durations and rebuilds its snapshot with the fixed bucket bounds. That histogram is built from an isolated configuration, so runtime bucket overrides fromprometheus.propertiesor system properties cannot reach it; with the default builder such an override would make every scrape fail.PrometheusSampleshelper that gives the samples the same shape the exposition has. The "unregistered after the last close" checks now look at what is registered, not at samples, so they fail if the unregister call is removed.pulsar-brokeraddsprometheus-metrics-core(already shipped).Metric and exposition format changes (for the 5.1 release notes)
Names, labels and values are unchanged. The text format differs the same way as in #27350: counter
# TYPElines carry_total,_createdseries are gone, summary and histogram counts are integers, labels are sorted. Histogram buckets are still cumulative with a+Infbucket.Verifying this change
This change added tests and can be verified as follows:
PrometheusMetricsTest.testScalableTopicMetricsAreScraped: one lookup request, then the broker/metricsshows the request duration histogram with the 12 fixed buckets and the gauges and counters of the four classes, all withcluster.ScalableTopicMetricsTest.testRuntimeBucketOverridesDoNotReachTheRequestHistogram: with a bucket override for the histogram name, the scrape still shows the 12 fixed buckets. It fails withIllegalArgumentExceptionwhen the histogram uses the default builder.cluster="test"series and checks the request count as a delta, because other test classes in the same JVM leave collectors for other cluster names on the shared default registry.org.apache.pulsar.broker.service.scalablepass, plusScalableTopicRequestMetricsTest,ScalableTopicRequestWriteMetricsTest,PulsarServiceTestandV5SegmentLoadReporterTest.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Dependencies:
pulsar-brokeraddsio.prometheus:prometheus-metrics-core1.8.0 (already shipped). Metrics: format changes listed above.Documentation
docdoc-requireddoc-not-neededdoc-complete