MCPcopy Index your code
hub / github.com/coder/coder / VersionSupportsPprof

Function VersionSupportsPprof

support/support.go:1151–1166  ·  view source on GitHub ↗

VersionSupportsPprof checks if the given version supports pprof endpoints.

(version string)

Source from the content-addressed store, hash-verified

1149
1150// VersionSupportsPprof checks if the given version supports pprof endpoints.
1151func VersionSupportsPprof(version string) bool {
1152 if version == "" {
1153 return false
1154 }
1155 if version[0] != 'v' {
1156 version = "v" + version
1157 }
1158 // For prerelease versions like "v2.28.0-devel+abc123", we compare
1159 // the major.minor.patch portion since prereleases of 2.28.0 should
1160 // have the pprof feature.
1161 canonical := semver.Canonical(version)
1162 if idx := strings.Index(canonical, "-"); idx != -1 {
1163 canonical = canonical[:idx]
1164 }
1165 return semver.Compare(canonical, minPprofVersion) >= 0
1166}
1167
1168func collectPprof(ctx context.Context, d *Deps, b *Bundle) Pprof {
1169 var pprof Pprof

Callers 2

TestVersionSupportsPprofFunction · 0.92
collectPprofFunction · 0.85

Calls 1

CompareMethod · 0.80

Tested by 1

TestVersionSupportsPprofFunction · 0.74