mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
[IMPROVED] $SYS.REQ.SERVER.PING.PROFILEZ always honored (#4393)
This commit is contained in:
@@ -3657,11 +3657,6 @@ type ProfilezStatus struct {
|
||||
}
|
||||
|
||||
func (s *Server) profilez(opts *ProfilezOptions) *ProfilezStatus {
|
||||
if s.profiler == nil {
|
||||
return &ProfilezStatus{
|
||||
Error: "Profiling is not enabled",
|
||||
}
|
||||
}
|
||||
if opts.Name == _EMPTY_ {
|
||||
return &ProfilezStatus{
|
||||
Error: "Profile name not specified",
|
||||
|
||||
@@ -4647,14 +4647,6 @@ func TestMonitorProfilez(t *testing.T) {
|
||||
s := RunServer(DefaultOptions())
|
||||
defer s.Shutdown()
|
||||
|
||||
// First of all, check that the profiles aren't accessible
|
||||
// when profiling hasn't been started in the usual way.
|
||||
if ps := s.profilez(&ProfilezOptions{
|
||||
Name: "allocs", Debug: 0,
|
||||
}); ps.Error == "" {
|
||||
t.Fatal("Profile should not be accessible when profiling not started")
|
||||
}
|
||||
|
||||
// Then start profiling.
|
||||
s.StartProfiler()
|
||||
|
||||
|
||||
@@ -2093,6 +2093,9 @@ func (s *Server) Start() {
|
||||
// Pprof http endpoint for the profiler.
|
||||
if opts.ProfPort != 0 {
|
||||
s.StartProfiler()
|
||||
} else {
|
||||
// Enable blocking profile even if no port defined since profiling is always possible over $SYS requests
|
||||
runtime.SetBlockProfileRate(1)
|
||||
}
|
||||
|
||||
if opts.ConfigFile != _EMPTY_ {
|
||||
|
||||
Reference in New Issue
Block a user