Skip to content

fix(adapter): start pprof server when profiling is enabled#9008

Open
theakshaypant wants to merge 1 commit intoknative:mainfrom
theakshaypant:fix/adapter-pprof-server-not-started
Open

fix(adapter): start pprof server when profiling is enabled#9008
theakshaypant wants to merge 1 commit intoknative:mainfrom
theakshaypant:fix/adapter-pprof-server-not-started

Conversation

@theakshaypant
Copy link
Copy Markdown

Fixes #9007

Proposed Changes

The eventing adapter framework creates and configures a ProfilingServer but never calls ListenAndServe, so the profiling port is never bound even when runtime-profiling is set to enabled in the observability ConfigMap. Start the server conditionally based on the initial config, consistent with the adapter's static observability config model.

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Profiling via the observability ConfigMap (`runtime-profiling: enabled`) now works correctly for components using the eventing adapter framework. Previously the profiling server was never started and port 8008 was never bound, making pprof endpoints unreachable.

Docs

Testing
My testing might have been limited to the use-case I was trying when I first ran into the original issue.
Covered three test scenarios:

  1. Nothing happens when config-observability has profiling disabled
  2. Enable profiling in the cm - able to access the profiling endpoints on port 8008.
  3. Enable profiling in the cm and explicitly set env on my deployment PROFILING_PORT=8090 - able to access the profiling endpoints on port 8090.

@knative-prow knative-prow bot requested review from creydr and pierDipi April 1, 2026 14:53
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 1, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: theakshaypant / name: Akshay Pant (f81324b)

@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 1, 2026

Welcome @theakshaypant! It looks like this is your first PR to knative/eventing 🎉

@knative-prow knative-prow bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 1, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 1, 2026

Hi @theakshaypant. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 1, 2026

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 1, 2026
@theakshaypant
Copy link
Copy Markdown
Author

I went through the logs from some of the failed tests and see error messages around TLS which I would guess is more of an infra issue rather than related to the PR changes. 🤔

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 2, 2026

I went through the logs from some of the failed tests and see error messages around TLS which I would guess is more of an infra issue rather than related to the PR changes. 🤔

Oh yes. Seems it needs #9009

@theakshaypant theakshaypant force-pushed the fix/adapter-pprof-server-not-started branch from cf53275 to add28c2 Compare April 6, 2026 05:23
@theakshaypant
Copy link
Copy Markdown
Author

I went through the logs from some of the failed tests and see error messages around TLS which I would guess is more of an infra issue rather than related to the PR changes. 🤔

Oh yes. Seems it needs #9009

Rebased with 9009 changes.

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 7, 2026

/test unit-tests

@theakshaypant theakshaypant force-pushed the fix/adapter-pprof-server-not-started branch from 411c3c6 to 9b7af76 Compare April 8, 2026 04:24
@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 8, 2026
The eventing adapter framework creates and configures a ProfilingServer
but never calls ListenAndServe, so the profiling port is never bound
even when runtime-profiling is set to enabled in the observability
ConfigMap. Start the server conditionally based on the initial config,
consistent with the adapter's static observability config model.

Fixes knative#9007

Signed-off-by: Akshay Pant <akpant@redhat.com>
@theakshaypant theakshaypant force-pushed the fix/adapter-pprof-server-not-started branch from 9b7af76 to f81324b Compare April 8, 2026 05:13
@theakshaypant
Copy link
Copy Markdown
Author

Apologies for the noise, added pprof server shutdown on context cancellation

$ go test -race -count=1 ./pkg/adapter/v2/ -timeout 60s
ok      knative.dev/eventing/pkg/adapter/v2     2.644s

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 14, 2026

Thanks for fixing this @theakshaypant
/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 14, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, theakshaypant

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.06%. Comparing base (263a3a5) to head (f81324b).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/adapter/v2/main.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9008      +/-   ##
==========================================
+ Coverage   51.04%   51.06%   +0.01%     
==========================================
  Files         409      409              
  Lines       21996    21996              
==========================================
+ Hits        11228    11232       +4     
+ Misses       9905     9900       -5     
- Partials      863      864       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 14, 2026

@theakshaypant: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
reconciler-tests_eventing_main f81324b link unknown /test reconciler-tests

Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profiling server not starting in the adapter framework

2 participants