small tweaks

This commit is contained in:
Felix Geisendörfer 2021-02-08 15:10:43 +01:00
parent bbef4f210c
commit f0ad919665
2 changed files with 9 additions and 0 deletions

View file

@ -1,6 +1,7 @@
package main package main
import ( import (
"context"
"fmt" "fmt"
"os" "os"
"runtime" "runtime"
@ -18,6 +19,10 @@ func main() {
} }
func run() error { func run() error {
labels := pprof.Labels("test_label", "test_value")
ctx := pprof.WithLabels(context.Background(), labels)
pprof.SetGoroutineLabels(ctx)
runtime.SetBlockProfileRate(int((40 * time.Microsecond).Nanoseconds())) runtime.SetBlockProfileRate(int((40 * time.Microsecond).Nanoseconds()))
done := make(chan struct{}) done := make(chan struct{})
g := errgroup.Group{} g := errgroup.Group{}

View file

@ -2,6 +2,10 @@
Totally a work in progress ... !!! Please come back later : ). Totally a work in progress ... !!! Please come back later : ).
https://twitter.com/felixge/status/1355846360562589696
## How does it work? ## How does it work?
Look at the go source code to understand how the data is captured, what role runtime.MemProfileRate plays, etc. Look at the go source code to understand how the data is captured, what role runtime.MemProfileRate plays, etc.