Documentation
¶
Overview ¶
Package summary は pprotein の API を叩いて計測結果を取り出し、 テキスト(Markdown)や JSON に整形する。CLI から使う。
Index ¶
- Variables
- func GroupIDs(entries []Entry) []string
- type Client
- func (c *Client) AllEntries() ([]Entry, error)
- func (c *Client) Config(typ string) ([]byte, error)
- func (c *Client) Content(typ, id string) (string, error)
- func (c *Client) Entries(typ string) ([]Entry, error)
- func (c *Client) GetQuery(path string, query url.Values) ([]byte, error)
- func (c *Client) RawData(typ, id string) ([]byte, error)
- func (c *Client) Score(id string) (*score.Value, error)
- func (c *Client) StartCollect() error
- type Diff
- type Endpoint
- type EndpointDiff
- type Entry
- type Func
- type Group
- type LabeledEndpoints
- type LabeledFuncs
- type LabeledQueries
- type LabeledText
- type Query
- type QueryDiff
- type ScoreDiff
Constants ¶
This section is empty.
Variables ¶
var CollectTypes = []string{"score", "httplog", "slowlog", "resource", "pprof", "memo"}
CollectTypes は summary が読む収集タイプ。表示する順に並べてある。
Functions ¶
Types ¶
type Client ¶
Client は pprotein の HTTP API クライアント。
func (*Client) AllEntries ¶
AllEntries は全タイプのエントリをまとめて取る。 収集タイプが存在しない(古い pprotein)場合はそのタイプを黙って飛ばす。
func (*Client) GetQuery ¶ added in v0.5.0
GetQuery は path にクエリ文字列を付けて GET する(path に ? を含めると JoinPath でエスケープされるため)。
type Diff ¶
type Diff struct {
Before, After *Group
Score *ScoreDiff
Endpoints []EndpointDiff
Queries []QueryDiff
}
Diff は2つの Group の差分。
type Endpoint ¶
type Endpoint struct {
Method string
Uri string
Count float64
Sum float64
Avg float64
P99 float64
Max float64
}
Endpoint は alp の1行。列は alp の設定で変わるので、ヘッダ名で引く。
func ParseEndpoints ¶
ParseEndpoints は alp の TSV を読む。SUM の大きい順に並べる。
type EndpointDiff ¶
type EndpointDiff struct {
Label string
Key string
CountBefore float64
CountAfter float64
SumBefore float64
SumAfter float64
AvgBefore float64
AvgAfter float64
}
func (EndpointDiff) AvgDelta ¶
func (d EndpointDiff) AvgDelta() float64
func (EndpointDiff) CountDelta ¶
func (d EndpointDiff) CountDelta() float64
func (EndpointDiff) Impact ¶
func (d EndpointDiff) Impact() float64
Impact は「リクエスト数を揃えたとき、合計でどれだけ時間が増減したか」。
ベンチが固定時間だと、速くしても空いた時間に次のリクエストが入るので SUM はほとんど動かない(代わりに件数が増える)。SUM の増減で並べると いちばん効いた施策が下に埋もれるので、1件あたりの増減に件数を掛けて順位を付ける。
func (EndpointDiff) SumDelta ¶
func (d EndpointDiff) SumDelta() float64
type Entry ¶
type Entry struct {
Snapshot struct {
Type string
ID string
Datetime time.Time
Repository *git.RepositoryInfo
GroupId string
Label string
Duration int
}
Status string
Message string
}
Entry は /api/<type> が返すエントリ。
type Func ¶
Func は pprof の1関数。
func ParseProfile ¶
ParseProfile は pprof のプロファイルから関数ごとの flat / cum を出す。
type Group ¶
type Group struct {
ID string
Datetime time.Time
Repository *git.RepositoryInfo
Score *score.Value
HTTPLog []LabeledEndpoints
SlowLog []LabeledQueries
Profiles []LabeledFuncs
Resource []LabeledText
Memo []LabeledText
// Pending / Failed は収集がまだ終わっていない / 失敗したエントリ。
Pending []string
Failed []string
}
Group は1回の収集(GroupId)の中身をまとめたもの。
type LabeledEndpoints ¶
type LabeledFuncs ¶
type LabeledQueries ¶
type LabeledText ¶
type Query ¶
type Query struct {
Query string
Count float64
Sum float64
Avg float64
Max float64
// RowsExamined は1回あたりの走査行数の平均。インデックスの当たり外れが出る。
RowsExamined float64
}
Query は slp の1行。
func ParseQueries ¶
ParseQueries は slp の TSV を読む。合計クエリ時間の大きい順に並べる。