Standard library / runtime/pprof

pprof.Labels()

Build a label set from alternating key/value strings. Use a small set of non-sensitive categories, not unique user IDs. Expected stdout: 'parse true\n'.

Formal Syntax & Structure

go syntaxgo
func Labels(args ...string) LabelSet

Parameters & Attributes

NameTypeDescription
args...stringAlternating key and value strings; an odd number panics.

Return Value

LabelSet

A set of profiling labels.

Working Example

Example Snippetgo
package main
import (  "context"  "fmt"  "runtime/pprof")
func main() {  l := pprof.Labels("phase", "parse")  c := pprof.WithLabels(context.Background(), l)  v, ok := pprof.Label(c, "phase")  fmt.Println(v, ok)}
Go Reference