Profiling endpoints for mcs (#1)

start and stop profiling endpoints, test includes and many fixes for
policies

deleting duplicated file
This commit is contained in:
Lenin Alevski
2020-04-02 09:57:59 -07:00
committed by GitHub
parent ed3cda28ee
commit 161941d544
25 changed files with 1801 additions and 34 deletions

View File

@@ -20,6 +20,7 @@ import (
"context"
"crypto/tls"
"hash/fnv"
"io"
"net"
"net/http"
"net/url"
@@ -141,7 +142,7 @@ type MinioAdmin interface {
addUser(ctx context.Context, acessKey, SecretKey string) error
listGroups(ctx context.Context) ([]string, error)
updateGroupMembers(ctx context.Context, greq madmin.GroupAddRemove) error
getGroupDescription(ctx context.Context, grouo string) (*madmin.GroupDesc, error)
getGroupDescription(ctx context.Context, group string) (*madmin.GroupDesc, error)
setGroupStatus(ctx context.Context, group string, status madmin.GroupStatus) error
listPolicies(ctx context.Context) (map[string][]byte, error)
getPolicy(ctx context.Context, name string) ([]byte, error)
@@ -153,6 +154,8 @@ type MinioAdmin interface {
setConfigKV(ctx context.Context, kv string) (err error)
serviceRestart(ctx context.Context) error
serverInfo(ctx context.Context) (madmin.InfoMessage, error)
startProfiling(ctx context.Context, profiler madmin.ProfilerType) ([]madmin.StartProfilingResult, error)
stopProfiling(ctx context.Context) (io.ReadCloser, error)
}
// Interface implementation
@@ -243,6 +246,16 @@ func (ac adminClient) serverInfo(ctx context.Context) (madmin.InfoMessage, error
return ac.client.ServerInfo(ctx)
}
// implements madmin.StartProfiling()
func (ac adminClient) startProfiling(ctx context.Context, profiler madmin.ProfilerType) ([]madmin.StartProfilingResult, error) {
return ac.client.StartProfiling(ctx, profiler)
}
// implements madmin.DownloadProfilingData()
func (ac adminClient) stopProfiling(ctx context.Context) (io.ReadCloser, error) {
return ac.client.DownloadProfilingData(ctx)
}
func newMAdminClient() (*madmin.AdminClient, error) {
endpoint := getMinIOServer()
accessKeyID := getAccessKey()