runtime パッケージは、アプリケーションのリソース使用状況に関する情報を公開します。また、モジュールの新しいバックグラウンド コンテキストでコードを実行する方法も提供します。
このパッケージは、App Engine の「フレキシブル環境」では動作しません。
関数
func RunInBackground
RunInBackground は、このプロセスのバックグラウンド goroutine で f を実行します。f には、RunInBackground に提供されたコンテキストよりも長く存続するコンテキストが提供されます。これは、基本スケーリングまたは手動スケーリングに設定されたサービスからの呼び出しに対してのみ有効です。
Statistics
type Statistics struct {
// CPU records the CPU consumed by this instance, in megacycles.
CPU struct {
Total float64
Rate1M float64 // consumption rate over one minute
Rate10M float64 // consumption rate over ten minutes
}
// RAM records the memory used by the instance, in megabytes.
RAM struct {
Current float64
Average1M float64 // average usage over one minute
Average10M float64 // average usage over ten minutes
}
}
Statistics は、システムの統計情報を表します。
func Stats
func Stats(c context.Context) (*Statistics, error)