Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Types = []string{"score", "httplog", "slowlog", "resource", "pprof", "memo"}
Types は Group に節がある収集タイプ。ptqd / dbquery は読まない(警告も出さない)。
Functions ¶
This section is empty.
Types ¶
type Diff ¶
type Diff struct {
// Before / After は比べた収集の GroupId。
Before, After string
Score *score.Diff `json:",omitempty"`
Commit *git.Diff `json:",omitempty"`
// Warnings は比較の前提が崩れているもの(片方の収集中・失敗のエントリなど)。
Warnings []string `json:",omitempty"`
Endpoints []EndpointDiff
Queries []QueryDiff
}
Diff は2つの収集の差分。
type Endpoint ¶
type Endpoint struct {
Method string
Uri string
Count float64
Sum float64 `json:"SumSec"`
Avg float64 `json:"AvgSec"`
P99 float64 `json:"P99Sec"`
Max float64 `json:"MaxSec"`
}
Endpoint は alp の1行。列は alp の設定で変わるので、ヘッダ名で引く。
func ParseEndpoints ¶
ParseEndpoints は alp の TSV を読む。SUM の大きい順に並べる。
type EndpointDiff ¶
type Func ¶
Func は pprof の1関数。Flat / Cum の単位は Unit(時間のプロファイルなら seconds)。
func ParseProfile ¶
ParseProfile は pprof のプロファイルから関数ごとの flat / cum を出す。
type Group ¶
type Group struct {
GroupId string
Datetime time.Time
Score *score.Brief `json:",omitempty"`
Commit *git.Commit `json:",omitempty"`
// Warnings は集計に含めていないエントリ(収集中・失敗・中身を読めなかったもの)。
Warnings []string `json:",omitempty"`
HTTPLog []LabeledEndpoints `json:",omitempty"`
SlowLog []LabeledQueries `json:",omitempty"`
Profiles []LabeledFuncs `json:",omitempty"`
Resource []LabeledText `json:",omitempty"`
Memo []LabeledText `json:",omitempty"`
}
Group は1回の収集(GroupId)の中身をまとめたもの。
type LabeledEndpoints ¶
type LabeledFuncs ¶
type LabeledQueries ¶
type LabeledText ¶
type Query ¶
type Query struct {
Query string
Count float64
Sum float64 `json:"SumSec"`
Avg float64 `json:"AvgSec"`
Max float64 `json:"MaxSec"`
// RowsExamined は1回あたりの走査行数の平均。インデックスの当たり外れが出る。
RowsExamined float64 `json:"RowsExaminedAvg"`
}
Query は slp の1行。
func ParseQueries ¶
ParseQueries は slp の TSV を読む。合計クエリ時間の大きい順に並べる。
type RowDiff ¶ added in v0.6.0
type RowDiff[T any] struct { Label string // Key は JSON に出さない(Before / After が持っている。SQL を何度も繰り返さない) Key string `json:"-"` Before *T `json:",omitempty"` After *T `json:",omitempty"` // Impact は件数を揃えたときの合計時間の増減。impact を参照。 Impact float64 `json:"ImpactSec"` }
RowDiff は before / after の同じ行(同じ label・同じキー)の組。 片方にしか無い行(追加・削除)は、もう片方が nil。
Click to show internal directories.
Click to hide internal directories.