Open wass88 opened 4 years ago
便利そう
import "github.com/pkg/profile"
defer profile.Start(profile.ProfilePath("/home/isucon/profile")).Stop()
X-Ra SDK for Go そんなに大変じゃなさそう https://docs.aws.amazon.com/ja_jp/xray/latest/devguide/xray-sdk-go-configuration.html
設定の例:
{
"version": 2,
"rules": [
{
"description": "Player moves.",
"host": "*",
"http_method": "*",
"url_path": "/api/move/*",
"fixed_target": 0,
"rate": 0.05
}
],
"default": {
"fixed_target": 1,
"rate": 0.1
}
}
発行されたSQLをstdoutにproxy https://github.com/shogo82148/go-sql-proxy 実行時間も出る
SQLのcaller埋め込む君をaerealさんが書いてたの思い出した go-sql-caller-annotation: GoでSQLに呼び出し元の情報をコメントとして埋め込む - Sexually Knowing
err漏れとかclose漏れとかの検出器ほしいな
resp.Body.close忘れるとTCPのstructが再利用されないらしいので気をつけたい
pprofだいたいこの記事を読んだら使い方がわかった http://blog.livedoor.jp/sonots/archives/39879160.html
https://blog.golang.org/pprof lineprofはlistコマンドでできる
X of Y やlistの初め2カラムは
go tool pprof --nodefraction=0.1
でノードを削れる profilePath := fmt.Sprintf("./profile/%s/", time.Now().Format("20060102150405"))
defer profile.Start(profile.ProfilePath(profilePath)).Stop()
https://gist.github.com/catatsuy/e627aaf118fbe001f2e7c665fda48146