github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/agent/spy/labels.go (about)

     1  package spy
     2  
     3  type Labels struct {
     4  	m map[string]string
     5  	s string
     6  }
     7  
     8  func NewLabels() *Labels {
     9  	return &Labels{
    10  		m: make(map[string]string),
    11  		s: "",
    12  	}
    13  }
    14  
    15  func (l *Labels) Set(key, val string) {
    16  	l.m[key] = val
    17  	l.s += key
    18  	l.s += ":"
    19  	l.s += val
    20  	l.s += "\n"
    21  }
    22  
    23  func (l *Labels) Tags() map[string]string {
    24  	return l.m
    25  }
    26  
    27  func (l *Labels) ID() string {
    28  	return l.s
    29  }