Skip to content

[management, signal] Read pprof listen address from environment#6448

Open
bison wants to merge 1 commit into
netbirdio:mainfrom
bison:pprof-addr
Open

[management, signal] Read pprof listen address from environment#6448
bison wants to merge 1 commit into
netbirdio:mainfrom
bison:pprof-addr

Conversation

@bison

@bison bison commented Jun 16, 2026

Copy link
Copy Markdown
Member

Describe your changes

This adds support for configuring the pprof listen address for the standalone management and signal services via the NB_PPROF_ADDR environment variable. The default address and behavior remain the same, i.e. pprof is enabled by default on: localhost:6060

Issue ticket number and link

Fixes: https://linear.app/netbird/issue/NET-1283

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

netbirdio/docs#798

Summary by CodeRabbit

  • New Features
    • pprof profiling server listen address is now configurable via the NB_PPROF_ADDR environment variable, with a default fallback to localhost:6060.

This adds support for configuring the pprof listen address for the
standalone management and signal services via the NB_PPROF_ADDR
environment variable.  The default address and behavior remain the
same, i.e. pprof is enabled by default on: `localhost:6060`
@CLAassistant

CLAassistant commented Jun 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Both management/main.go and signal/cmd/run.go replace hardcoded pprof listen addresses with a pprofAddr() helper function that reads the NB_PPROF_ADDR environment variable, falling back to localhost:6060 when the variable is unset or empty. The pprof server startup in each service is updated to use this computed address.

Changes

Configurable pprof address via NB_PPROF_ADDR

Layer / File(s) Summary
pprofAddr() helpers and pprof server wiring
management/main.go, signal/cmd/run.go
Both files add a pprofAddr() function that returns NB_PPROF_ADDR when set or defaults to localhost:6060. The pprof http.ListenAndServe call in management/main.go and startPprof() in signal/cmd/run.go are updated to use the computed address. signal/cmd/run.go also adds an os import and updates the pprof log message accordingly.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hoppity-hop, no more hardcoded address!
The pprof server listens where you say,
NB_PPROF_ADDR sets the stage each day.
Management and signal, both hopping in line,
With a sensible default of localhost:6060 — just fine!
This rabbit approves, with a wiggle and a bow. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding environment variable support for pprof listen address configuration in management and signal services.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description fully addresses the template requirements with clear change description, issue link, completed checklist items, and documentation reference.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.36%. Comparing base (38ad2b6) to head (40f369e).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
signal/cmd/run.go 0.00% 8 Missing ⚠️
management/main.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6448   +/-   ##
=======================================
  Coverage   30.36%   30.36%           
=======================================
  Files         912      912           
  Lines      113721   113736   +15     
=======================================
+ Hits        34533    34539    +6     
- Misses      74619    74620    +1     
- Partials     4569     4577    +8     
Flag Coverage Δ
client 29.40% <ø> (+0.03%) ⬆️
integration 42.58% <ø> (ø)
management 29.48% <0.00%> (-0.02%) ⬇️
proxy 42.53% <ø> (-0.05%) ⬇️
relay 35.91% <ø> (-0.06%) ⬇️
signal 16.65% <0.00%> (-0.10%) ⬇️
unit 30.32% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants