GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [feat][monitor] PIP-320: Add OpenTelemetry metrics for the Function Worker by Dream95 · Pull Request #26823 · apache/pulsar

Conversation

@Dream95

@Dream95 Dream95 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Main Issue:

PIP: #21635

Motivation

The Function Worker publishes its operational metrics through WorkerStatsManager, which writes to the legacy Prometheus registry. The worker also initializes an OpenTelemetry SDK in PulsarWorkerOpenTelemetry, but it is not actually used. Operators who enable OTel metrics get the broker metrics and nothing from the worker.

This PR continues PIP-320 by registering the worker's operational metrics on the meter that already exists, so the new instruments flow through the same OTel exporters as the broker metrics.
The broker made the same move under PIP-264.

Modifications

  • Add OpenTelemetryWorkerStats, which registers the worker's operational instruments on the worker meter: second-based duration histograms for schedule, schedule strategy, rebalance, rebalancestrategy, drain, instance start and instance stop, plus observable gauges for instance count, expected instance count, function count and leader state.
  • Wire WorkerStatsManager to record each measurement to both the existing Prometheus metric and the new OTel instrument, so existing /metrics scrapers keep working unchanged; the legacy metrics are annotated with @PulsarDeprecatedMetric pointing at their replacement names.
  • Read leadership from leaderService::isLeader instead of the WorkerUtils getIsStillLeaderSupplier, which performed a synchronous admin getStats() call on the coordination topic during every metrics scrape.
  • Pass the worker's real OpenTelemetry instance into WorkerServer.FilterInitializer instead of
    OpenTelemetry.noop(), so the RateLimitingFilter metrics are exported as well.
  • Add opentelemetry-sdk-testing as a test-only dependency and cover the new instruments in
    OpenTelemetryWorkerStatsTest.

Verifying this change

This change added tests and can be verified as follows:

  • ./gradlew :pulsar-functions:pulsar-functions-worker:test --tests "org.apache.pulsar.functions.worker.OpenTelemetryWorkerStatsTest"

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Dream95
[feat][monitor] PIP-320: Add OpenTelemetry metrics for the Function W…
c5f77d4
…orker

Signed-off-by: Dream95 <[email protected]>
codelipenghui
codelipenghui approved these changes Oct 5, 2026
View reviewed changes
@codelipenghui codelipenghui assigned Dream95 Oct 5, 2026
@Dream95

Dream95 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@merlimat
merlimat merged commit 846f21b into apache:master Oct 17, 2026
82 of 84 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@merlimat merlimat added this to the 5.1.0 milestone Oct 17, 2026
lhotari pushed a commit that referenced this pull request Oct 17, 2026
@Dream95 @lhotari
[feat][monitor] PIP-320: Add OpenTelemetry metrics for the Function W…
8180b59
…orker (#26823)

Signed-off-by: Dream95 <[email protected]>
(cherry picked from commit 846f21b)
@lhotari lhotari added release/5.0.1 cherry-picked/branch-5.0 labels Oct 17, 2026
@merlimat merlimat mentioned this pull request Oct 24, 2026
[Fn][Observability] Status of OpenTelemetry metrics support (PIP-264/PIP-320) #25885
Open
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@codelipenghui codelipenghui codelipenghui approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Dream95 Dream95

Labels

cherry-picked/branch-5.0 release/5.0.1

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Dream95 @codelipenghui @merlimat @lhotari
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.