Skip to content

Commit

Permalink
Feat: add possibility to disable pprof form
Browse files Browse the repository at this point in the history
  • Loading branch information
odnobit committed Jan 7, 2025
1 parent 8ecbde9 commit ab1e30b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 10 additions & 9 deletions web/landing_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ import (

// Config represents the configuration of the web listener.
type LandingConfig struct {
HeaderColor string // Used for the landing page header.
CSS string // CSS style tag for the landing page.
Name string // The name of the exporter, generally suffixed by _exporter.
Description string // A short description about the exporter.
Form LandingForm // A POST form.
Links []LandingLinks // Links displayed on the landing page.
ExtraHTML string // Additional HTML to be embedded.
ExtraCSS string // Additional CSS to be embedded.
Version string // The version displayed.
HeaderColor string // Used for the landing page header.
CSS string // CSS style tag for the landing page.
Name string // The name of the exporter, generally suffixed by _exporter.
Description string // A short description about the exporter.
Form LandingForm // A POST form.
Links []LandingLinks // Links displayed on the landing page.
ExtraHTML string // Additional HTML to be embedded.
ExtraCSS string // Additional CSS to be embedded.
Version string // The version displayed.
DisablePprofForm bool // Disable pprof report form
}

// LandingForm provides a configuration struct for creating a POST form on the landing page.
Expand Down
2 changes: 2 additions & 0 deletions web/landing_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h1>{{.Name}}</h1>
</div>
{{ end }}
{{ .ExtraHTML }}
{{ if not .DisablePprofForm }}
<div id="pprof">
Download a detailed report of resource usage (pprof format, from the Go runtime):
<ul>
Expand All @@ -38,6 +39,7 @@ <h1>{{.Name}}</h1>
</ul>
To visualize and share profiles you can upload to <a href="https://pprof.me" target="_blank">pprof.me</a>
</div>
{{ end }}
</main>
</body>
</html>

0 comments on commit ab1e30b

Please sign in to comment.