Skip to content

Commit

Permalink
Add updateService operation for observability
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyingjie committed Mar 22, 2021
1 parent 2c71a06 commit c8e7744
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions pkg/object/meshcontroller/worker/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

const (
easeAgentConfigManager = "com.megaease.easeagent:type=ConfigManager"
updateServiceOperation = "updateService"
)

type (
Expand All @@ -37,9 +38,25 @@ func (server *ObservabilityManager) UpdateObservability(serviceName string, newO

logger.Infof("Update Service: %s Observability, new Observability is %s", serviceName, newObservability)

_, err := server.jolokiaClient.ExecuteMbeanOperation(easeAgentConfigManager, "updateObservability", args)
_, err := server.jolokiaClient.ExecuteMbeanOperation(easeAgentConfigManager, updateServiceOperation, args)
if err != nil {
return fmt.Errorf("updateObservability service: %s observability failed: %v", serviceName, err)
return fmt.Errorf("update service: %s observability failed: %v", serviceName, err)
}

return nil
}


// UpdateService updates service.
func (server *ObservabilityManager) UpdateService(newService *spec.Service) error {
paramsMap := structs.Map(newService)
args := []interface{}{paramsMap}

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

_, err := server.jolokiaClient.ExecuteMbeanOperation(easeAgentConfigManager, updateServiceOperation, args)
if err != nil {
return fmt.Errorf("UpdateService service: %s failed: %v", newService.Name, err)
}

return nil
Expand Down

0 comments on commit c8e7744

Please sign in to comment.