From 64270296b959b462aac28f9018d5a1e6010dbd51 Mon Sep 17 00:00:00 2001
From: fangyincheng <fangyincheng@sina.com>
Date: Thu, 23 May 2019 17:32:51 +0800
Subject: [PATCH] Rem:delete pprof

---
 config/config_loader.go                       |  8 -----
 config/testdata/consumer_config.yml           |  4 ---
 config/testdata/provider_config.yml           |  4 ---
 examples/dubbo/go-client/app/client.go        | 31 -------------------
 .../dubbo/go-client/profiles/dev/client.yml   |  4 ---
 .../go-client/profiles/release/client.yml     |  4 ---
 .../dubbo/go-client/profiles/test/client.yml  |  4 ---
 examples/dubbo/go-server/app/server.go        | 31 -------------------
 .../dubbo/go-server/profiles/dev/server.yml   |  4 ---
 .../go-server/profiles/release/server.yml     |  4 ---
 .../dubbo/go-server/profiles/test/server.yml  |  4 ---
 examples/jsonrpc/go-client/app/client.go      | 31 -------------------
 .../jsonrpc/go-client/profiles/dev/client.yml |  3 --
 .../go-client/profiles/release/client.yml     |  4 +--
 .../go-client/profiles/test/client.yml        |  3 --
 examples/jsonrpc/go-server/app/server.go      | 31 -------------------
 .../jsonrpc/go-server/profiles/dev/server.yml |  4 ---
 .../go-server/profiles/release/server.yml     |  4 ---
 .../go-server/profiles/test/server.yml        |  4 ---
 19 files changed, 1 insertion(+), 185 deletions(-)

diff --git a/config/config_loader.go b/config/config_loader.go
index 44a2ccd75..8e5cf18cf 100644
--- a/config/config_loader.go
+++ b/config/config_loader.go
@@ -142,10 +142,6 @@ func providerInit(confProFile string) error {
 /////////////////////////
 
 type ConsumerConfig struct {
-	// pprof
-	Pprof_Enabled bool `default:"false" yaml:"pprof_enabled" json:"pprof_enabled,omitempty"`
-	Pprof_Port    int  `default:"10086"  yaml:"pprof_port" json:"pprof_port,omitempty"`
-
 	Filter string `yaml:"filter" json:"filter,omitempty"`
 
 	// client
@@ -185,10 +181,6 @@ func GetConsumerConfig() ConsumerConfig {
 /////////////////////////
 
 type ProviderConfig struct {
-	// pprof
-	Pprof_Enabled bool `default:"false" yaml:"pprof_enabled" json:"pprof_enabled,omitempty"`
-	Pprof_Port    int  `default:"10086"  yaml:"pprof_port" json:"pprof_port,omitempty"`
-
 	Filter       string `yaml:"filter" json:"filter,omitempty"`
 	ProxyFactory string `yaml:"proxy_factory" default:"default" json:"proxy_factory,omitempty"`
 
diff --git a/config/testdata/consumer_config.yml b/config/testdata/consumer_config.yml
index 2d850e805..8a9aeafac 100644
--- a/config/testdata/consumer_config.yml
+++ b/config/testdata/consumer_config.yml
@@ -1,9 +1,5 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
-
 filter: ""
 
 # client
diff --git a/config/testdata/provider_config.yml b/config/testdata/provider_config.yml
index 5c97379a9..6c7da0636 100644
--- a/config/testdata/provider_config.yml
+++ b/config/testdata/provider_config.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 filter: ""
 # application config
 application_config:
diff --git a/examples/dubbo/go-client/app/client.go b/examples/dubbo/go-client/app/client.go
index 62ae4a105..6d99695d5 100644
--- a/examples/dubbo/go-client/app/client.go
+++ b/examples/dubbo/go-client/app/client.go
@@ -17,11 +17,8 @@ package main
 import (
 	"context"
 	"fmt"
-	"net/http"
-	_ "net/http/pprof"
 	"os"
 	"os/signal"
-	"strconv"
 	"syscall"
 	"time"
 )
@@ -33,7 +30,6 @@ import (
 
 import (
 	_ "github.com/dubbo/go-for-apache-dubbo/common/proxy/proxy_factory"
-	"github.com/dubbo/go-for-apache-dubbo/common/utils"
 	"github.com/dubbo/go-for-apache-dubbo/config"
 	_ "github.com/dubbo/go-for-apache-dubbo/protocol/dubbo"
 	_ "github.com/dubbo/go-for-apache-dubbo/registry/protocol"
@@ -63,8 +59,6 @@ func main() {
 		panic("conMap is nil")
 	}
 
-	initProfiling()
-
 	println("\n\n\necho")
 	res, err := conMap["com.ikurento.user.UserProvider"].GetRPCService().(*UserProvider).Echo(context.TODO(), "OK")
 	if err != nil {
@@ -107,31 +101,6 @@ func main() {
 	initSignal()
 }
 
-func initProfiling() {
-	if !config.GetConsumerConfig().Pprof_Enabled {
-		return
-	}
-	const (
-		PprofPath = "/debug/pprof/"
-	)
-	var (
-		err  error
-		ip   string
-		addr string
-	)
-
-	ip, err = utils.GetLocalIP()
-	if err != nil {
-		panic("cat not get local ip!")
-	}
-	addr = ip + ":" + strconv.Itoa(config.GetConsumerConfig().Pprof_Port)
-	log.Info("App Profiling startup on address{%v}", addr+PprofPath)
-
-	go func() {
-		log.Info(http.ListenAndServe(addr, nil))
-	}()
-}
-
 func initSignal() {
 	signals := make(chan os.Signal, 1)
 	// It is not possible to block SIGKILL or syscall.SIGSTOP
diff --git a/examples/dubbo/go-client/profiles/dev/client.yml b/examples/dubbo/go-client/profiles/dev/client.yml
index 5fa71ecec..5e58f4cc6 100644
--- a/examples/dubbo/go-client/profiles/dev/client.yml
+++ b/examples/dubbo/go-client/profiles/dev/client.yml
@@ -1,9 +1,5 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
-
 # client
 request_timeout : "100ms"
 # connect timeout
diff --git a/examples/dubbo/go-client/profiles/release/client.yml b/examples/dubbo/go-client/profiles/release/client.yml
index f56fb22d6..269e9cbac 100644
--- a/examples/dubbo/go-client/profiles/release/client.yml
+++ b/examples/dubbo/go-client/profiles/release/client.yml
@@ -1,9 +1,5 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
-
 # client
 request_timeout : "100ms"
 # connect timeout
diff --git a/examples/dubbo/go-client/profiles/test/client.yml b/examples/dubbo/go-client/profiles/test/client.yml
index f56fb22d6..269e9cbac 100644
--- a/examples/dubbo/go-client/profiles/test/client.yml
+++ b/examples/dubbo/go-client/profiles/test/client.yml
@@ -1,9 +1,5 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
-
 # client
 request_timeout : "100ms"
 # connect timeout
diff --git a/examples/dubbo/go-server/app/server.go b/examples/dubbo/go-server/app/server.go
index ed30da6da..f8de7da0d 100644
--- a/examples/dubbo/go-server/app/server.go
+++ b/examples/dubbo/go-server/app/server.go
@@ -16,11 +16,8 @@ package main
 
 import (
 	"fmt"
-	"net/http"
-	_ "net/http/pprof"
 	"os"
 	"os/signal"
-	"strconv"
 	"syscall"
 	"time"
 )
@@ -31,7 +28,6 @@ import (
 )
 
 import (
-	"github.com/dubbo/go-for-apache-dubbo/common/utils"
 	"github.com/dubbo/go-for-apache-dubbo/config"
 	_ "github.com/dubbo/go-for-apache-dubbo/protocol/dubbo"
 	_ "github.com/dubbo/go-for-apache-dubbo/registry/protocol"
@@ -64,36 +60,9 @@ func main() {
 		panic("proMap is nil")
 	}
 
-	initProfiling()
-
 	initSignal()
 }
 
-func initProfiling() {
-	if !config.GetProviderConfig().Pprof_Enabled {
-		return
-	}
-	const (
-		PprofPath = "/debug/pprof/"
-	)
-	var (
-		err  error
-		ip   string
-		addr string
-	)
-
-	ip, err = utils.GetLocalIP()
-	if err != nil {
-		panic("can not get local ip!")
-	}
-	addr = ip + ":" + strconv.Itoa(config.GetProviderConfig().Pprof_Port)
-	log.Info("App Profiling startup on address{%v}", addr+PprofPath)
-
-	go func() {
-		log.Info(http.ListenAndServe(addr, nil))
-	}()
-}
-
 func initSignal() {
 	signals := make(chan os.Signal, 1)
 	// It is not possible to block SIGKILL or syscall.SIGSTOP
diff --git a/examples/dubbo/go-server/profiles/dev/server.yml b/examples/dubbo/go-server/profiles/dev/server.yml
index 0af02a495..6477a6638 100644
--- a/examples/dubbo/go-server/profiles/dev/server.yml
+++ b/examples/dubbo/go-server/profiles/dev/server.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 # application config
 application_config:
     organization : "ikurento.com"
diff --git a/examples/dubbo/go-server/profiles/release/server.yml b/examples/dubbo/go-server/profiles/release/server.yml
index 00a4060a9..728e8802d 100644
--- a/examples/dubbo/go-server/profiles/release/server.yml
+++ b/examples/dubbo/go-server/profiles/release/server.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 # application config
 application_config:
   organization : "ikurento.com"
diff --git a/examples/dubbo/go-server/profiles/test/server.yml b/examples/dubbo/go-server/profiles/test/server.yml
index 00a4060a9..728e8802d 100644
--- a/examples/dubbo/go-server/profiles/test/server.yml
+++ b/examples/dubbo/go-server/profiles/test/server.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 # application config
 application_config:
   organization : "ikurento.com"
diff --git a/examples/jsonrpc/go-client/app/client.go b/examples/jsonrpc/go-client/app/client.go
index 4dd53dff3..e9e963889 100644
--- a/examples/jsonrpc/go-client/app/client.go
+++ b/examples/jsonrpc/go-client/app/client.go
@@ -17,11 +17,8 @@ package main
 import (
 	"context"
 	"fmt"
-	"net/http"
-	_ "net/http/pprof"
 	"os"
 	"os/signal"
-	"strconv"
 	"syscall"
 	"time"
 )
@@ -32,7 +29,6 @@ import (
 
 import (
 	_ "github.com/dubbo/go-for-apache-dubbo/common/proxy/proxy_factory"
-	"github.com/dubbo/go-for-apache-dubbo/common/utils"
 	"github.com/dubbo/go-for-apache-dubbo/config"
 	_ "github.com/dubbo/go-for-apache-dubbo/protocol/jsonrpc"
 	_ "github.com/dubbo/go-for-apache-dubbo/registry/protocol"
@@ -58,8 +54,6 @@ func main() {
 		panic("conMap is nil")
 	}
 
-	initProfiling()
-
 	println("\n\n\necho")
 	res, err := conMap["com.ikurento.user.UserProvider"].GetRPCService().(*UserProvider).Echo(context.TODO(), "OK")
 	if err != nil {
@@ -103,31 +97,6 @@ func main() {
 	initSignal()
 }
 
-func initProfiling() {
-	if !config.GetConsumerConfig().Pprof_Enabled {
-		return
-	}
-	const (
-		PprofPath = "/debug/pprof/"
-	)
-	var (
-		err  error
-		ip   string
-		addr string
-	)
-
-	ip, err = utils.GetLocalIP()
-	if err != nil {
-		panic("cat not get local ip!")
-	}
-	addr = ip + ":" + strconv.Itoa(config.GetConsumerConfig().Pprof_Port)
-	log.Info("App Profiling startup on address{%v}", addr+PprofPath)
-
-	go func() {
-		log.Info(http.ListenAndServe(addr, nil))
-	}()
-}
-
 func initSignal() {
 	signals := make(chan os.Signal, 1)
 	// It is not possible to block SIGKILL or syscall.SIGSTOP
diff --git a/examples/jsonrpc/go-client/profiles/dev/client.yml b/examples/jsonrpc/go-client/profiles/dev/client.yml
index c79972717..50ed8d501 100644
--- a/examples/jsonrpc/go-client/profiles/dev/client.yml
+++ b/examples/jsonrpc/go-client/profiles/dev/client.yml
@@ -1,8 +1,5 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
 check: true
 # client
 request_timeout : "3s"
diff --git a/examples/jsonrpc/go-client/profiles/release/client.yml b/examples/jsonrpc/go-client/profiles/release/client.yml
index 1b7f1a6f8..5aae8b717 100644
--- a/examples/jsonrpc/go-client/profiles/release/client.yml
+++ b/examples/jsonrpc/go-client/profiles/release/client.yml
@@ -1,8 +1,6 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
+
 check: true
 # client
 request_timeout : "3s"
diff --git a/examples/jsonrpc/go-client/profiles/test/client.yml b/examples/jsonrpc/go-client/profiles/test/client.yml
index 1b7f1a6f8..5e0c0cea0 100644
--- a/examples/jsonrpc/go-client/profiles/test/client.yml
+++ b/examples/jsonrpc/go-client/profiles/test/client.yml
@@ -1,8 +1,5 @@
 # dubbo client yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 10086
 check: true
 # client
 request_timeout : "3s"
diff --git a/examples/jsonrpc/go-server/app/server.go b/examples/jsonrpc/go-server/app/server.go
index a374b1b5c..2373692d1 100644
--- a/examples/jsonrpc/go-server/app/server.go
+++ b/examples/jsonrpc/go-server/app/server.go
@@ -16,11 +16,8 @@ package main
 
 import (
 	"fmt"
-	"net/http"
-	_ "net/http/pprof"
 	"os"
 	"os/signal"
-	"strconv"
 	"syscall"
 	"time"
 )
@@ -31,7 +28,6 @@ import (
 
 import (
 	_ "github.com/dubbo/go-for-apache-dubbo/common/proxy/proxy_factory"
-	"github.com/dubbo/go-for-apache-dubbo/common/utils"
 	"github.com/dubbo/go-for-apache-dubbo/config"
 	_ "github.com/dubbo/go-for-apache-dubbo/protocol/jsonrpc"
 	_ "github.com/dubbo/go-for-apache-dubbo/registry/protocol"
@@ -57,36 +53,9 @@ func main() {
 		panic("proMap is nil")
 	}
 
-	initProfiling()
-
 	initSignal()
 }
 
-func initProfiling() {
-	if !config.GetProviderConfig().Pprof_Enabled {
-		return
-	}
-	const (
-		PprofPath = "/debug/pprof/"
-	)
-	var (
-		err  error
-		ip   string
-		addr string
-	)
-
-	ip, err = utils.GetLocalIP()
-	if err != nil {
-		panic("cat not get local ip!")
-	}
-	addr = ip + ":" + strconv.Itoa(config.GetProviderConfig().Pprof_Port)
-	log.Info("App Profiling startup on address{%v}", addr+PprofPath)
-
-	go func() {
-		log.Info(http.ListenAndServe(addr, nil))
-	}()
-}
-
 func initSignal() {
 	signals := make(chan os.Signal, 1)
 	// It is not possible to block SIGKILL or syscall.SIGSTOP
diff --git a/examples/jsonrpc/go-server/profiles/dev/server.yml b/examples/jsonrpc/go-server/profiles/dev/server.yml
index a12a35daf..945df75c1 100644
--- a/examples/jsonrpc/go-server/profiles/dev/server.yml
+++ b/examples/jsonrpc/go-server/profiles/dev/server.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 # application config
 application_config:
     organization : "ikurento.com"
diff --git a/examples/jsonrpc/go-server/profiles/release/server.yml b/examples/jsonrpc/go-server/profiles/release/server.yml
index 570035656..597c493d9 100644
--- a/examples/jsonrpc/go-server/profiles/release/server.yml
+++ b/examples/jsonrpc/go-server/profiles/release/server.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 # application config
 application_config:
   organization : "ikurento.com"
diff --git a/examples/jsonrpc/go-server/profiles/test/server.yml b/examples/jsonrpc/go-server/profiles/test/server.yml
index 570035656..597c493d9 100644
--- a/examples/jsonrpc/go-server/profiles/test/server.yml
+++ b/examples/jsonrpc/go-server/profiles/test/server.yml
@@ -1,9 +1,5 @@
 # dubbo server yaml configure file
 
-# pprof
-pprof_enabled : true
-pprof_port : 20080
-
 # application config
 application_config:
   organization : "ikurento.com"
-- 
GitLab