profefe

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileTypeCPU       = "cpu"
	ProfileTypeHeap      = "heap"
	ProfileTypeBlock     = "block"
	ProfileTypeMutex     = "mutex"
	ProfileTypeGoroutine = "goroutine"
	ProfileTypeOther     = "other"
)

Variables

This section is empty.

Functions

func AllProfileTypes

func AllProfileTypes() []string

func GetProfileType

func GetProfileType() []string

Types

type Client

type Client struct {
	Config
	http.Client
}

func NewClient

func NewClient(config Config, httpClient http.Client) *Client

func (*Client) GetProfiles

func (c *Client) GetProfiles(ctx context.Context, req GetProfilesRequest) (*GetProfilesResponse, error)

GET /api/0/profiles?service=<service>&type=<type>from=<created_from>&to=<created_to>&labels=<key=value,key=value>

func (*Client) GetServices added in v0.1.0

func (c *Client) GetServices(ctx context.Context) (*GetServicesResponse, error)

GET /api/0/services

func (*Client) SavePprof

func (c *Client) SavePprof(ctx context.Context, req SavePprofRequest) (*SavePprofResponse, error)

https://github.com/profefe/profefe#save-pprof-data POST /api/0/profiles?service=<service>&instance_id=<iid>&type=[cpu|heap]&labels=<key=value,key=value> body pprof.pb.gz

type Config

type Config struct {
	HostPort  string
	UserAgent string
}

type GetProfilesRequest

type GetProfilesRequest struct {
	// service name
	Service string
	// cpu, heap, block, mutex, or goroutine
	Type ProfileType
	// a set of key-value pairs, e.g. "region=europe-west3,dc=fra,ip=1.2.3.4,version=1.0"
	Labels map[string]string

	From, To time.Time
}

type GetProfilesResponse

type GetProfilesResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
	Body  []struct {
		ID        string    `json:"id"`
		Type      string    `json:"type"`
		Service   string    `json:"service"`
		CreatedAt time.Time `json:"created_at"`
	} `json:"body"`
}

type GetServicesResponse added in v0.1.0

type GetServicesResponse struct {
	Body  []string
	Error string `json:"error"`
}

type ProfileType

type ProfileType int8
const (
	UnknownProfile ProfileType = iota
	CPUProfile
	HeapProfile
	BlockProfile
	MutexProfile
	GoroutineProfile
	ThreadcreateProfile

	OtherProfile = 127
)

func NewProfileTypeFromString

func NewProfileTypeFromString(s string) ProfileType

func (ProfileType) String

func (ptype ProfileType) String() string

type SavePprofRequest

type SavePprofRequest struct {
	Profile *profile.Profile
	// service name
	Service string
	// an identifier of running instance
	InstanceID string
	// cpu, heap, block, mutex, or goroutine
	Type ProfileType
	// a set of key-value pairs, e.g. "region=europe-west3,dc=fra,ip=1.2.3.4,version=1.0"
	Labels map[string]string
}

type SavePprofResponse

type SavePprofResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
	Body  struct {
		ID        string    `json:"id"`
		Type      string    `json:"type"`
		Service   string    `json:"service"`
		CreatedAt time.Time `json:"created_at"`
	} `json:"body"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL