Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: New service exposing CPU, memory, etc profiling information #446

Merged
merged 20 commits into from
Jan 18, 2023

Conversation

dadrus
Copy link
Owner

@dadrus dadrus commented Jan 17, 2023

Related issue(s)

closes #445

Checklist

  • I agree to follow this project's Code of Conduct.
  • I have read, and I am following this repository's Contributing Guidelines.
  • I have read the Security Policy.
  • I have referenced an issue describing the bug/feature request.
  • I have added tests that prove the correctness of my implementation.
  • I have updated the documentation.

Description

This PR implements a new service, which if enabled exposes profiling information on port 4458 (configurable) with following paths:

  • /debug/pprof - responds with an HTML page listing the available profiles (see below)
  • /debug/pprof/cmdline - responds with the running program's command line, with arguments separated by NUL bytes
  • /debug/pprof/profile - responds with the pprof-formatted cpu profile. Profiling lasts for duration specified in seconds parameter, or for 30 seconds if not specified
  • /debug/pprof/symbol - looks up the program counters listed in the request, responding with a table mapping program counters to function names
  • /debug/pprof/trace - responds with the execution trace in binary form. Tracing lasts for duration specified in seconds GET parameter, or for 1 second if not specified.

The configuration of this service happens in the profiling config property and supports the following values:

enabled: false # or true. false is default
host: "127.0.0.1" # loopback interface only. So must be set to another value if operated in docker.
port: 4458

The helm chat has been updated as well to support the configuration of this new service in sense of the exposed port (same value as above) und the ip this service is listenimg to. Latter is set to 0.0.0.0 to enable the usage by corresponding agents without the need for additional configuration. If enabled, it also sets annotations for Phlare to let an available phlare installation scrape the corresponding information. If Phlare is not installed, the annotations do not have any effect. The helm chart does not create a k8s service for this port.

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Merging #446 (e8c05b6) into main (f00e0ec) will decrease coverage by 0.22%.
The diff coverage is 16.66%.

@@            Coverage Diff             @@
##             main     #446      +/-   ##
==========================================
- Coverage   88.17%   87.96%   -0.22%     
==========================================
  Files         200      202       +2     
  Lines        8053     8077      +24     
==========================================
+ Hits         7101     7105       +4     
- Misses        780      800      +20     
  Partials      172      172              
Impacted Files Coverage Δ
internal/config/configuration.go 100.00% <ø> (ø)
internal/config/profiling.go 0.00% <0.00%> (ø)
internal/handler/profiling/module.go 17.39% <17.39%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dadrus dadrus changed the title feat: New service exposing CPU & memory profiling information wip: New service exposing CPU & memory profiling information Jan 17, 2023
@dadrus dadrus changed the title wip: New service exposing CPU & memory profiling information feat: New service exposing CPU, memory, etc profiling information Jan 18, 2023
@dadrus dadrus merged commit 2175273 into main Jan 18, 2023
@dadrus dadrus deleted the feat/profiling_service branch January 18, 2023 18:46
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.

Expose CPU & memory profile information
1 participant