-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two endpoints should be on the profiler port rather than the main port: `gc_stats` and `live_profiler`. This is done by installing them on the default mux used by the profiler, rather than a custom mux passed on to the main server. Once `live_profiler` is on the internal profiler port, we can remove the `127.0.0.1` remote-ip restriction to make it easier to use, given that the default base image is a no-login image.
- Loading branch information
Showing
8 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package integration_test | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var ( | ||
gcStatsPath = "/gc_stats" | ||
liveProfilerPath = "/live_profiler?mode=off" | ||
pprofPath = "/debug/pprof/" | ||
) | ||
|
||
var _ = Describe("Profiler Endpoints", func() { | ||
var ( | ||
client *http.Client | ||
) | ||
|
||
BeforeEach(func() { | ||
cfg, err := GetTLSConfig() | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
client = &http.Client{ | ||
Transport: &http.Transport{ | ||
TLSClientConfig: cfg, | ||
}, | ||
} | ||
}) | ||
|
||
Context("Service port", func() { | ||
DescribeTable("returns 400", | ||
func(path string) { | ||
r, err := client.Get(fmt.Sprintf("https://%s%s", serviceURL, path)) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(r.StatusCode).To(Equal(400)) | ||
}, | ||
|
||
Entry("for "+gcStatsPath, gcStatsPath), | ||
Entry("for "+liveProfilerPath, liveProfilerPath), | ||
Entry("for "+pprofPath, pprofPath)) | ||
}) | ||
|
||
Context("Profiler port", func() { | ||
DescribeTable("succeeds", | ||
func(path string, expectedCode int) { | ||
r, err := client.Get(fmt.Sprintf("http://%s%s", monitoringURL, path)) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(r.StatusCode).To(Equal(expectedCode)) | ||
}, | ||
|
||
Entry("for "+gcStatsPath, gcStatsPath, 200), | ||
Entry("for "+liveProfilerPath, liveProfilerPath, 304), // We get 304 when the profiler is enabled, and we ask it to switch to the mode it is already in | ||
Entry("for "+pprofPath, pprofPath, 200), | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters