payload

package
v1.4.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyValAdd

func KeyValAdd(kv *KeyVal, key string, value string)

KeyValAdd adds a key + value string pair to kv

func KeyValToInterfaceMap

func KeyValToInterfaceMap(kv *KeyVal) map[string]interface{}

KeyValToInterfaceMap converts KeyVal to map[string]interface

func KeyValToInterfaceSlice

func KeyValToInterfaceSlice(kv *KeyVal) []interface{}

KeyValToInterfaceSlice converts KeyVal to []interface{}, typically used for logging

func MergeKeyVal

func MergeKeyVal(target *KeyVal, source *KeyVal)

MergeKeyVal will merge source in target

func MergeKeyValWithPrefix

func MergeKeyValWithPrefix(target *KeyVal, source *KeyVal, prefix string)

MergeKeyValWithPrefix will merge source in target, adding a prefix to each key being merged in

Types

type App

type App struct {
	Name        string `json:"name,omitempty"`
	Namespace   string `json:"namespace,omitempty"`
	Release     string `json:"release,omitempty"`
	Version     string `json:"version,omitempty"`
	Environment string `json:"environment,omitempty"`
}

App holds metadata about the application event originates from

func (App) KeyVal

func (a App) KeyVal() *KeyVal

KeyVal produces key-> value representation of App metadata

type Browser

type Browser struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
	OS      string `json:"os,omitempty"`
	Mobile  bool   `json:"mobile,omitempty"`
}

Browser holds metadata about a client's browser

func (Browser) KeyVal

func (b Browser) KeyVal() *KeyVal

KeyVal produces key->value representation of the Browser metadata

type Event

type Event struct {
	Name       string            `json:"name"`
	Domain     string            `json:"domain,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
	Timestamp  time.Time         `json:"timestamp,omitempty"`
	Trace      TraceContext      `json:"trace,omitempty"`
}

Event holds RUM event data

func (Event) KeyVal

func (e Event) KeyVal() *KeyVal

KeyVal produces key -> value representation of Event metadata

type Exception

type Exception struct {
	Type       string           `json:"type,omitempty"`
	Value      string           `json:"value,omitempty"`
	Stacktrace *Stacktrace      `json:"stacktrace,omitempty"`
	Timestamp  time.Time        `json:"timestamp"`
	Trace      TraceContext     `json:"trace,omitempty"`
	Context    ExceptionContext `json:"context,omitempty"`
}

Exception struct controls all the data regarding an exception

func (Exception) KeyVal

func (e Exception) KeyVal() *KeyVal

KeyVal representation of the exception object

func (Exception) Message

func (e Exception) Message() string

Message string is concatenating of the Exception.Type and Exception.Value

func (Exception) String

func (e Exception) String() string

String is the string representation of an Exception

type ExceptionContext

type ExceptionContext map[string]string

ExceptionContext is a string to string map structure that represents the context of an exception

type Frame

type Frame struct {
	Function string `json:"function,omitempty"`
	Module   string `json:"module,omitempty"`
	Filename string `json:"filename,omitempty"`
	Lineno   int    `json:"lineno,omitempty"`
	Colno    int    `json:"colno,omitempty"`
}

Frame struct represents a single stacktrace frame

func (Frame) String

func (frame Frame) String() string

String function converts a Frame into a human readable string

type KeyVal

type KeyVal = om.OrderedMap

KeyVal is an ordered map of string to interface

func KeyValFromFloatMap added in v1.2.0

func KeyValFromFloatMap(m map[string]float64) *KeyVal

KeyValFromMap will instantiate KeyVal from a map[string]float64

func KeyValFromMap

func KeyValFromMap(m map[string]string) *KeyVal

KeyValFromMap will instantiate KeyVal from a map[string]string

func NewKeyVal

func NewKeyVal() *KeyVal

NewKeyVal creates new empty KeyVal

func SpanToKeyVal

func SpanToKeyVal(s ptrace.Span) *KeyVal

SpanToKeyVal returns KeyVal representation of a Span.

type Log

type Log struct {
	Message   string       `json:"message,omitempty"`
	LogLevel  LogLevel     `json:"level,omitempty"`
	Context   LogContext   `json:"context,omitempty"`
	Timestamp time.Time    `json:"timestamp"`
	Trace     TraceContext `json:"trace,omitempty"`
}

Log struct controls the data that come into a Log message

func (Log) KeyVal

func (l Log) KeyVal() *KeyVal

KeyVal representation of a Log object

type LogContext

type LogContext map[string]string

LogContext is a string to string map structure that represents the context of a log message

type LogLevel

type LogLevel string

LogLevel is log level enum for incoming app logs

const (
	// LogLevelTrace is "trace"
	LogLevelTrace LogLevel = "trace"
	// LogLevelDebug is "debug"
	LogLevelDebug LogLevel = "debug"
	// LogLevelInfo is "info"
	LogLevelInfo LogLevel = "info"
	// LogLevelWarning is "warning"
	LogLevelWarning LogLevel = "warning"
	// LogLevelError is "error"
	LogLevelError LogLevel = "error"
)

type Measurement

type Measurement struct {
	Type      string             `json:"type,omitempty"`
	Values    map[string]float64 `json:"values,omitempty"`
	Timestamp time.Time          `json:"timestamp,omitempty"`
	Trace     TraceContext       `json:"trace,omitempty"`
	Context   MeasurementContext `json:"context,omitempty"`
}

Measurement holds the data for user provided measurements

func (Measurement) KeyVal

func (m Measurement) KeyVal() *KeyVal

KeyVal representation of the measurement object

type MeasurementContext

type MeasurementContext map[string]string

MeasurementContext is a string to string map structure that represents the context of a log message

type Meta

type Meta struct {
	SDK     SDK     `json:"sdk,omitempty"`
	App     App     `json:"app,omitempty"`
	User    User    `json:"user,omitempty"`
	Session Session `json:"session,omitempty"`
	Page    Page    `json:"page,omitempty"`
	Browser Browser `json:"browser,omitempty"`
	View    View    `json:"view,omitempty"`
}

Meta holds metadata about an app event

func (Meta) KeyVal

func (m Meta) KeyVal() *KeyVal

KeyVal produces key->value representation of the app event metadata

type Page

type Page struct {
	ID         string            `json:"id,omitempty"`
	URL        string            `json:"url,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

Page holds metadata about the web page event originates from

func (Page) KeyVal

func (p Page) KeyVal() *KeyVal

KeyVal produces key->val representation of Page metadata

type Payload

type Payload struct {
	Exceptions   []Exception   `json:"exceptions,omitempty"`
	Logs         []Log         `json:"logs,omitempty"`
	Measurements []Measurement `json:"measurements,omitempty"`
	Events       []Event       `json:"events,omitempty"`
	Meta         Meta          `json:"meta,omitempty"`
	Traces       *Traces       `json:"traces,omitempty"`
}

Payload is the body of the receiver request

type SDK

type SDK struct {
	Name         string           `json:"name,omitempty"`
	Version      string           `json:"version,omitempty"`
	Integrations []SDKIntegration `json:"integrations,omitempty"`
}

SDK holds metadata about the app agent that produced the event

func (SDK) KeyVal

func (sdk SDK) KeyVal() *KeyVal

KeyVal produces key->value representation of Sdk metadata

type SDKIntegration

type SDKIntegration struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

SDKIntegration holds metadata about a plugin/integration on the app agent that collected and sent the event

func (SDKIntegration) String

func (i SDKIntegration) String() string

type Session

type Session struct {
	ID         string            `json:"id,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

Session holds metadata about the browser session the event originates from

func (Session) KeyVal

func (s Session) KeyVal() *KeyVal

KeyVal produces key->value representation of the Session metadata

type Stacktrace

type Stacktrace struct {
	Frames []Frame `json:"frames,omitempty"`
}

Stacktrace is a collection of Frames

type TraceContext

type TraceContext struct {
	TraceID string `json:"trace_id"`
	SpanID  string `json:"span_id"`
}

TraceContext holds trace id and span id associated to an entity (log, exception, measurement...).

func (TraceContext) KeyVal

func (tc TraceContext) KeyVal() *KeyVal

KeyVal representation of the trace context object.

type Traces

type Traces struct {
	ptrace.Traces
}

Traces wraps the otel traces model.

func (Traces) MarshalJSON

func (t Traces) MarshalJSON() ([]byte, error)

MarshalJSON marshals Traces model to json.

func (Traces) SpanSlice

func (t Traces) SpanSlice() []ptrace.Span

SpanSlice unpacks Traces entity into a slice of Spans.

func (*Traces) UnmarshalJSON

func (t *Traces) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals Traces model.

type User

type User struct {
	Email      string            `json:"email,omitempty"`
	ID         string            `json:"id,omitempty"`
	Username   string            `json:"username,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

User holds metadata about the user related to an app event

func (User) KeyVal

func (u User) KeyVal() *KeyVal

KeyVal produces a key->value representation User metadata

type View

type View struct {
	Name string `json:"name,omitempty"`
}

View holds metadata about a view

func (View) KeyVal

func (v View) KeyVal() *KeyVal

Jump to

Keyboard shortcuts

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