Documentation ¶
Index ¶
- func ExceptionCodeString(v interface{}) string
- func GlobalLabelsFrom(from map[string]any, to *modelpb.APMEvent)
- func HTTPHeadersToModelpb(h http.Header, out []*modelpb.HTTPHeader) []*modelpb.HTTPHeader
- func HTTPHeadersToStructPb(h http.Header) *structpb.Struct
- func MergeLabels(eventLabels map[string]any, to *modelpb.APMEvent)
- func NormalizeHTTPRequestBody(v interface{}) interface{}
- func NormalizeLabelValues(labels map[string]any) map[string]any
- func Reslice[Slice ~[]model, model any](slice Slice, n int) Slice
- func ResliceAndPopulateNil[Slice ~[]*model, model any](slice Slice, n int, newFn func() *model) Slice
- func SetInternalMetrics(event *modelpb.APMEvent) bool
- func ToKv(m map[string]any, out []*modelpb.KeyValue) []*modelpb.KeyValue
- func ToStruct(m map[string]any) *structpb.Struct
- func ToValue(a any) *structpb.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExceptionCodeString ¶
func ExceptionCodeString(v interface{}) string
ExceptionCodeString formats the exception code v as a string.
func GlobalLabelsFrom ¶
GlobalLabelsFrom populates the Labels and NumericLabels from global labels in the metadata object.
func HTTPHeadersToModelpb ¶
func HTTPHeadersToModelpb(h http.Header, out []*modelpb.HTTPHeader) []*modelpb.HTTPHeader
func HTTPHeadersToStructPb ¶
HTTPHeadersToStructPb converts h to a *structpb.Struct, suitable for use in modelpb.HTTP.{Request,Response}.Headers.
func MergeLabels ¶
MergeLabels merges eventLabels into the APMEvent. This is used for combining event-specific labels onto (metadata) global labels.
If eventLabels is non-nil, it is first cloned.
func NormalizeHTTPRequestBody ¶
func NormalizeHTTPRequestBody(v interface{}) interface{}
NormalizeHTTPRequestBody recurses through v, replacing any instance of a json.Number with float64.
TODO(axw) define a more restrictive schema for context.request.body so this is unnecessary. Agents are unlikely to send numbers, but seeing as the schema does not prevent it we need this.
func NormalizeLabelValues ¶
NormalizeLabelValues transforms the values in labels, replacing any instance of json.Number with float64, and returning labels.
func Reslice ¶
Reslice returns a slice with length n. It will reallocate the slice if the capacity is not enough.
func ResliceAndPopulateNil ¶ added in v1.9.1
func ResliceAndPopulateNil[Slice ~[]*model, model any](slice Slice, n int, newFn func() *model) Slice
ResliceAndPopulateNil ensures a slice of pointers has atleast capacity for n elements and populates any non-nil elements in the resulting slice with the value returned from newFn.
func SetInternalMetrics ¶
SetInternalMetrics extracts well-known internal metrics from event.Metricset.Samples, setting the appropriate field on event.Span (if non-nil) and finally setting event.Metricset.Samples to nil.
Any unknown metrics sent by agents in a metricset with transaction.* set will be silently discarded.
SetInternalMetrics returns true if any known metric samples were found, and false otherwise. If no known metric samples were found, the caller may opt to omit the metricset altogether.
Types ¶
This section is empty.