diff --git a/api/controller/resources.go b/api/controller/resources.go index fd789c2fe..65e96f908 100644 --- a/api/controller/resources.go +++ b/api/controller/resources.go @@ -710,7 +710,6 @@ func (t *TenantStruct) UpdateService(w http.ResponseWriter, r *http.Request) { // schema: // "$ref": "#/responses/commandResponse" // description: 统一返回格式 - logrus.Debugf("trans update service service") //目前提供三个元素的修改 rules := validator.MapData{ "container_cmd": []string{}, @@ -742,10 +741,8 @@ func (t *TenantStruct) UpdateService(w http.ResponseWriter, r *http.Request) { httputil.ReturnBcodeError(r, w, err) return } - - logrus.Debugf("begin to update service") if err := handler.GetServiceManager().ServiceUpdate(data); err != nil { - httputil.ReturnError(r, w, 500, fmt.Sprintf("update service error, %v", err)) + httputil.ReturnBcodeError(r, w, err) return } httputil.ReturnSuccess(r, w, nil) @@ -773,7 +770,6 @@ func (t *TenantStruct) SetLanguage(w http.ResponseWriter, r *http.Request) { // schema: // "$ref": "#/responses/commandResponse" // description: 统一返回格式 - logrus.Debugf("trans language set service") rules := validator.MapData{ "language": []string{"required"}, } diff --git a/api/handler/service.go b/api/handler/service.go index c71716780..4ab7f097d 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -747,14 +747,11 @@ func (s *ServiceAction) ServiceUpdate(sc map[string]interface{}) error { } ts.AppID = sc["app_id"].(string) version, err := db.GetManager().VersionInfoDao().GetVersionByDeployVersion(ts.DeployVersion, ts.ServiceID) - if sc["container_memory"] != nil { - ts.ContainerMemory = sc["container_memory"].(int) + if memory, ok := sc["container_memory"].(int); ok && memory != 0 { + ts.ContainerMemory = memory } - if sc["container_cmd"] != nil { - version.Cmd = sc["container_cmd"].(string) - } - if sc["service_name"] != nil { - ts.ServiceName = sc["service_name"].(string) + if name, ok := sc["service_name"].(string); ok && name != "" { + ts.ServiceName = name } if sc["extend_method"] != nil { extendMethod := sc["extend_method"].(string) diff --git a/go.mod b/go.mod index 1ca2c3f78..e04655500 100644 --- a/go.mod +++ b/go.mod @@ -85,6 +85,7 @@ require ( golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e google.golang.org/grpc v1.29.0 + gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.3.0 k8s.io/api v0.19.0 diff --git a/node/nodem/monitor/monitor_manager.go b/node/nodem/monitor/monitor_manager.go index d2aae032c..3fdf8dc56 100644 --- a/node/nodem/monitor/monitor_manager.go +++ b/node/nodem/monitor/monitor_manager.go @@ -33,6 +33,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/node_exporter/collector" "github.com/sirupsen/logrus" + kingpin "gopkg.in/alecthomas/kingpin.v2" ) //Manager Manager @@ -55,6 +56,8 @@ func createNodeExporterRestry() (*prometheus.Registry, error) { "ipvs", "loadavg", "meminfo", "netdev", "netclass", "netdev", "netstat", "uname", "mountstats", "nfs"} + // init kingpin parse + kingpin.CommandLine.Parse([]string{"--collector.mountstats=true"}) nc, err := collector.NewNodeCollector(log.NewNopLogger(), filters...) if err != nil { return nil, err