mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
Implement glustercli command to disable and delete the current tracing configuration on the cluster. The changes include gd2 transaction that first deletes the trace configuration from the store on one node and then a subsequent step clears the in-memory trace configuration on all nodes. closes #1368 Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
63 lines
2.2 KiB
Go
63 lines
2.2 KiB
Go
package tracemgmt
|
|
|
|
import (
|
|
"github.com/gluster/glusterd2/glusterd2/servers/rest/route"
|
|
"github.com/gluster/glusterd2/glusterd2/transaction"
|
|
"github.com/gluster/glusterd2/pkg/utils"
|
|
tracemgmtapi "github.com/gluster/glusterd2/plugins/tracemgmt/api"
|
|
)
|
|
|
|
// Plugin is a structure which implements GlusterdPlugin interface
|
|
type Plugin struct {
|
|
}
|
|
|
|
// Name returns name of plugin
|
|
func (p *Plugin) Name() string {
|
|
return "tracemgmt"
|
|
}
|
|
|
|
// RestRoutes returns a list of REST API routes to register with Glusterd
|
|
func (p *Plugin) RestRoutes() route.Routes {
|
|
return route.Routes{
|
|
route.Route{
|
|
Name: "TraceEnable",
|
|
Method: "POST",
|
|
Pattern: "/tracemgmt",
|
|
Version: 1,
|
|
RequestType: utils.GetTypeString((*tracemgmtapi.SetupTracingReq)(nil)),
|
|
ResponseType: utils.GetTypeString((*tracemgmtapi.JaegerConfigInfo)(nil)),
|
|
HandlerFunc: tracingEnableHandler},
|
|
route.Route{
|
|
Name: "TraceStatus",
|
|
Method: "GET",
|
|
Pattern: "/tracemgmt",
|
|
Version: 1,
|
|
ResponseType: utils.GetTypeString((*tracemgmtapi.JaegerConfigInfo)(nil)),
|
|
HandlerFunc: tracingStatusHandler},
|
|
route.Route{
|
|
Name: "TraceUpdate",
|
|
Method: "POST",
|
|
Pattern: "/tracemgmt/update",
|
|
Version: 1,
|
|
RequestType: utils.GetTypeString((*tracemgmtapi.SetupTracingReq)(nil)),
|
|
ResponseType: utils.GetTypeString((*tracemgmtapi.JaegerConfigInfo)(nil)),
|
|
HandlerFunc: tracingUpdateHandler},
|
|
route.Route{
|
|
Name: "TraceDisable",
|
|
Method: "DELETE",
|
|
Pattern: "/tracemgmt",
|
|
Version: 1,
|
|
HandlerFunc: tracingDisableHandler},
|
|
}
|
|
}
|
|
|
|
// RegisterStepFuncs registers transaction step functions with Glusterd transaction framework
|
|
func (p *Plugin) RegisterStepFuncs() {
|
|
transaction.RegisterStepFunc(txnTracingValidateConfig, "trace-mgmt.ValidateTraceConfig")
|
|
transaction.RegisterStepFunc(txnTracingStoreConfig, "trace-mgmt.StoreTraceConfig")
|
|
transaction.RegisterStepFunc(txnTracingUndoStoreConfig, "trace-mgmt.RestoreTraceConfig")
|
|
transaction.RegisterStepFunc(txnTracingDeleteStoreConfig, "trace-mgmt.UndoStoreTraceConfig")
|
|
transaction.RegisterStepFunc(txnTracingApplyNewConfig, "trace-mgmt.NotifyTraceConfigChange")
|
|
transaction.RegisterStepFunc(txnTracingDisable, "trace-mgmt.NotifyTraceDisable")
|
|
}
|