modeldecoderutil

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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

func GlobalLabelsFrom(from map[string]any, to *modelpb.APMEvent)

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

func HTTPHeadersToStructPb(h http.Header) *structpb.Struct

HTTPHeadersToStructPb converts h to a *structpb.Struct, suitable for use in modelpb.HTTP.{Request,Response}.Headers.

func MergeLabels

func MergeLabels(eventLabels map[string]any, to *modelpb.APMEvent)

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

func NormalizeLabelValues(labels map[string]any) map[string]any

NormalizeLabelValues transforms the values in labels, replacing any instance of json.Number with float64, and returning labels.

func Reslice

func Reslice[Slice ~[]model, model any](slice Slice, n int, newFn func() model) Slice

Reslice increases the slice's capacity, if necessary, to match n. If specified, the newFn function is used to create the elements to populate the additional space appended to the slice.

func SetInternalMetrics

func SetInternalMetrics(event *modelpb.APMEvent) bool

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.

func ToKv

func ToKv(m map[string]any, out []*modelpb.KeyValue) []*modelpb.KeyValue

func ToStruct

func ToStruct(m map[string]any) *structpb.Struct

func ToValue

func ToValue(a any) *structpb.Value

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL