github.com/grafana/pyroscope@v1.18.0/pkg/distributor/annotation/sampling.go (about)

     1  package annotation
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/grafana/pyroscope/pkg/distributor/sampling"
     7  )
     8  
     9  type SampledAnnotation struct {
    10  	Source *sampling.Source `json:"source"`
    11  }
    12  
    13  func CreateProfileAnnotation(source *sampling.Source) ([]byte, error) {
    14  	a := &ProfileAnnotation{
    15  		Body: SampledAnnotation{
    16  			Source: source,
    17  		},
    18  	}
    19  	return json.Marshal(a)
    20  }