Skip to content

Commit

Permalink
modify Observability updateService processing
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyingjie committed Mar 23, 2021
1 parent 0606cae commit 8699974
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/object/meshcontroller/worker/observability.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package worker

import (
"encoding/json"
"fmt"
yaml "gopkg.in/yaml.v2"
"gopkg.in/yaml.v2"

"github.com/megaease/easegateway/pkg/logger"
"github.com/megaease/easegateway/pkg/object/meshcontroller/spec"
"github.com/megaease/easegateway/pkg/util/jmxtool"

yamljsontool "github.com/ghodss/yaml"
)

const (
Expand Down Expand Up @@ -36,15 +39,16 @@ func (server *ObservabilityManager) UpdateService(newService *spec.Service, vers

buff, err := yaml.Marshal(newService)
if err != nil {
panic(fmt.Errorf("marsharl new Service %#v failed: %v", err))
return fmt.Errorf("UpdateService service: %s failed: %v", newService.Name, err)
}
m := make(map[string]interface{})
err = yaml.Unmarshal(buff, m)
jsonBytes, err := yamljsontool.YAMLToJSON(buff)

var params interface{}
err = json.Unmarshal(jsonBytes, &params)
if err != nil {
panic(fmt.Errorf("marsharl new Service %#v failed: %v", err))
return fmt.Errorf("UpdateService service: %s failed: %v", newService.Name, err)
}

args := []interface{}{m, version}
args := []interface{}{params, version}

logger.Infof("Update Service: %s Observability, new Service is %s", newService.Name, newService)

Expand Down

0 comments on commit 8699974

Please sign in to comment.