pprof Cloud Run Funcrions調査
手元でCloud Run Functionsのコンテナレス実行環境を整えていれば、"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"がすでにimportされていると思うが、pprofのstatsを取るには加えて通常のhttpを立てる必要がある code:main.go
package main
import (
"log"
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
_ "github.com/ci7lus/hoge/functions/piyo"
)
func main() {
port := "8080"
if err := funcframework.Start(port); err != nil {
log.Panicf("funcframework.Start: %v\n", err)
}
}
code:main.go
package main
import (
"log"
"net/http"
_ "net/http/pprof"
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
_ "github.com/ci7lus/hoge/functions/piyo"
)
func main() {
go func() {
err := http.ListenAndServe(":8081", nil)
if err != nil {
panic(err)
}
}()
port := "8080"
if err := funcframework.Start(port); err != nil {
log.Panicf("funcframework.Start: %v\n", err)
}
}
そして
code:sh