Documentation ¶
Index ¶
- Constants
- Variables
- func KeyValAdd(kv *KeyVal, key string, value string)
- func KeyValToInterfaceMap(kv *KeyVal) map[string]interface{}
- func KeyValToInterfaceSlice(kv *KeyVal) []interface{}
- func MergeKeyVal(target *KeyVal, source *KeyVal)
- func MergeKeyValWithPrefix(target *KeyVal, source *KeyVal, prefix string)
- func NewLogsExporter(logger kitlog.Logger, conf LogsExporterConfig, sourceMapStore SourceMapStore) appAgentReceiverExporter
- func NewReceiverMetricsExporter(reg prometheus.Registerer) appAgentReceiverExporter
- func NewTracesExporter(getTracesConsumer tracesConsumerGetter) appAgentReceiverExporter
- type App
- type AppAgentReceiverHandler
- type Browser
- type Config
- func (c *Config) ApplyDefaults(globals integrations.Globals) error
- func (c *Config) Identifier(globals integrations.Globals) (string, error)
- func (c *Config) Name() string
- func (c *Config) NewIntegration(l log.Logger, globals integrations.Globals) (integrations.Integration, error)
- func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Event
- type Exception
- type Frame
- type KeyVal
- type Log
- type LogContext
- type LogLevel
- type LogsExporter
- type LogsExporterConfig
- type Measurement
- type Meta
- type Page
- type Payload
- type RateLimitingConfig
- type RealSourceMapStore
- type ReceiverMetricsExporter
- type SDK
- type SDKIntegration
- type ServerConfig
- type Session
- type SourceMap
- type SourceMapConfig
- type SourceMapFileLocation
- type SourceMapStore
- type Stacktrace
- type TraceContext
- type Traces
- type TracesExporter
- type User
Constants ¶
const ( // DefaultRateLimitingRPS is the default value of Requests Per Second // for ratelimiting DefaultRateLimitingRPS = 100 // DefaultRateLimitingBurstiness is the default burstiness factor of the // token bucket algorigthm DefaultRateLimitingBurstiness = 50 // DefaultMaxPayloadSize is the max paylad size in bytes DefaultMaxPayloadSize = 5e6 )
Variables ¶
var DefaultConfig = Config{ Server: ServerConfig{ Host: "127.0.0.1", Port: 12347, RateLimiting: RateLimitingConfig{ Enabled: true, RPS: DefaultRateLimitingRPS, Burstiness: DefaultRateLimitingBurstiness, }, MaxAllowedPayloadSize: DefaultMaxPayloadSize, }, LogsLabels: map[string]string{}, LogsSendTimeout: time.Second * 2, SourceMaps: SourceMapConfig{ DownloadFromOrigins: []string{"*"}, DownloadTimeout: time.Second, }, }
DefaultConfig holds the default configuration of the receiver
var IntegrationName = "app_agent_receiver"
IntegrationName is the name of this integration
Functions ¶
func KeyValToInterfaceMap ¶
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 ¶
MergeKeyVal will merge source in target
func MergeKeyValWithPrefix ¶
MergeKeyValWithPrefix will merge source in target, adding a prefix to each key being merged in
func NewLogsExporter ¶
func NewLogsExporter(logger kitlog.Logger, conf LogsExporterConfig, sourceMapStore SourceMapStore) appAgentReceiverExporter
NewLogsExporter creates a new logs exporter with the given configuration
func NewReceiverMetricsExporter ¶
func NewReceiverMetricsExporter(reg prometheus.Registerer) appAgentReceiverExporter
NewReceiverMetricsExporter creates a new ReceiverMetricsExporter
func NewTracesExporter ¶
func NewTracesExporter(getTracesConsumer tracesConsumerGetter) appAgentReceiverExporter
NewTracesExporter creates a trace exporter for the app agent receiver.
Types ¶
type App ¶
type App struct { Name string `json:"name,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
type AppAgentReceiverHandler ¶
type AppAgentReceiverHandler struct {
// contains filtered or unexported fields
}
AppAgentReceiverHandler struct controls the data ingestion http handler of the receiver
func NewAppAgentReceiverHandler ¶
func NewAppAgentReceiverHandler(conf *Config, exporters []appAgentReceiverExporter, reg prometheus.Registerer) AppAgentReceiverHandler
NewAppAgentReceiverHandler creates a new AppReceiver instance based on the given configuration
func (*AppAgentReceiverHandler) HTTPHandler ¶
func (ar *AppAgentReceiverHandler) HTTPHandler(logger log.Logger) http.Handler
HTTPHandler is the http.Handler for the receiver. It will do the following 0. Enable CORS for the configured hosts 1. Check if the request should be rate limited 2. Verify that the payload size is within limits 3. Start two go routines for exporters processing and exporting data respectively 4. Respond with 202 once all the work is done
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
type Config ¶
type Config struct { Common common.MetricsConfig `yaml:",inline"` Server ServerConfig `yaml:"server,omitempty"` TracesInstance string `yaml:"traces_instance,omitempty"` LogsInstance string `yaml:"logs_instance,omitempty"` LogsLabels map[string]string `yaml:"logs_labels,omitempty"` LogsSendTimeout time.Duration `yaml:"logs_send_timeout,omitempty"` SourceMaps SourceMapConfig `yaml:"sourcemaps,omitempty"` }
Config is the configuration struct of the integration
func (*Config) ApplyDefaults ¶
ApplyDefaults applies runtime-specific defaults to c.
func (*Config) Identifier ¶
Identifier uniquely identifies the app agent receiver integration
func (*Config) NewIntegration ¶
func (c *Config) NewIntegration(l log.Logger, globals integrations.Globals) (integrations.Integration, error)
NewIntegration converts this config into an instance of an integration
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the Unmarshaler interface
type Event ¶ added in v0.27.0
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
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"` }
Exception struct controls all the data regarding an exception
func TransformException ¶
func TransformException(store SourceMapStore, log log.Logger, ex *Exception, release string) *Exception
TransformException will attempt to resolved all monified source locations in the stacktrace with original source locations
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 ResolveSourceLocation ¶
func ResolveSourceLocation(store SourceMapStore, frame *Frame, release string) (*Frame, error)
ResolveSourceLocation resolves minified source location to original source location
type KeyVal ¶
type KeyVal = om.OrderedMap
KeyVal is an ordered map of string to interface
func KeyValFromMap ¶
KeyValFromMap will instantiate KeyVal from a map[string]string
func SpanToKeyVal ¶
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
type LogContext ¶
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 LogsExporter ¶
type LogsExporter struct {
// contains filtered or unexported fields
}
LogsExporter will send logs & errors to loki
func (*LogsExporter) Export ¶
func (le *LogsExporter) Export(ctx context.Context, payload Payload) error
Export implements the AppDataExporter interface
func (*LogsExporter) Name ¶
func (le *LogsExporter) Name() string
Name of the exporter, for logging purposes
type LogsExporterConfig ¶
type LogsExporterConfig struct { SendEntryTimeout time.Duration GetLogsInstance logsInstanceGetter Labels map[string]string }
LogsExporterConfig holds the configuration of the logs exporter
type Measurement ¶
type Measurement struct { Values map[string]float64 `json:"values,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` Trace TraceContext `json:"trace,omitempty"` }
Measurement holds the data for user provided measurements
func (Measurement) KeyVal ¶
func (m Measurement) KeyVal() *KeyVal
KeyVal representation of the exception object
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"` }
Meta holds metadata about an app event
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
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 RateLimitingConfig ¶
type RateLimitingConfig struct { Enabled bool `yaml:"enabled,omitempty"` RPS float64 `yaml:"rps,omitempty"` Burstiness int `yaml:"burstiness,omitempty"` }
RateLimitingConfig holds the configuration of the rate limiter
type RealSourceMapStore ¶
RealSourceMapStore is an implementation of SourceMapStore that can download source maps or read them from file system
func (*RealSourceMapStore) GetSourceMap ¶
func (store *RealSourceMapStore) GetSourceMap(sourceURL string, release string) (*SourceMap, error)
GetSourceMap returns sourcemap for a given source url
type ReceiverMetricsExporter ¶
type ReceiverMetricsExporter struct {
// contains filtered or unexported fields
}
ReceiverMetricsExporter is a app agent receiver exporter that will capture metrics about counts of logs, exceptions, measurements, traces being ingested
func (*ReceiverMetricsExporter) Export ¶
func (re *ReceiverMetricsExporter) Export(ctx context.Context, payload Payload) error
Export implements the AppDataExporter interface
func (*ReceiverMetricsExporter) Name ¶
func (re *ReceiverMetricsExporter) Name() string
Name of the exporter, for logging purposes
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
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 ServerConfig ¶
type ServerConfig struct { Host string `yaml:"host,omitempty"` Port int `yaml:"port,omitempty"` CORSAllowedOrigins []string `yaml:"cors_allowed_origins,omitempty"` RateLimiting RateLimitingConfig `yaml:"rate_limiting,omitempty"` APIKey string `yaml:"api_key,omitempty"` MaxAllowedPayloadSize int64 `yaml:"max_allowed_payload_size,omitempty"` }
ServerConfig holds the receiver http server configuration
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
type SourceMap ¶
type SourceMap struct {
// contains filtered or unexported fields
}
SourceMap is a wrapper for go-sourcemap consumer
type SourceMapConfig ¶
type SourceMapConfig struct { Download bool `yaml:"download"` DownloadFromOrigins []string `yaml:"download_origins,omitempty"` DownloadTimeout time.Duration `yaml:"download_timeout,omitempty"` FileSystem []SourceMapFileLocation `yaml:"filesystem,omitempty"` }
SourceMapConfig configure source map locations
type SourceMapFileLocation ¶
type SourceMapFileLocation struct { Path string `yaml:"path"` MinifiedPathPrefix string `yaml:"minified_path_prefix,omitempty"` }
SourceMapFileLocation holds sourcemap location on file system
type SourceMapStore ¶
type SourceMapStore interface {
GetSourceMap(sourceURL string, release string) (*SourceMap, error)
}
SourceMapStore is interface for a sourcemap service capable of transforming minified source locations to original source location
func NewSourceMapStore ¶
func NewSourceMapStore(l log.Logger, config SourceMapConfig, reg prometheus.Registerer, httpClient httpClient, fileService fileService) SourceMapStore
NewSourceMapStore creates an instance of SourceMapStore. httpClient and fileService will be instantiated to defaults if nil is provided
type Stacktrace ¶
type Stacktrace struct {
Frames []Frame `json:"frames,omitempty"`
}
Stacktrace is a collection of Frames
type TraceContext ¶
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 ¶
Traces wraps the otel traces model.
func (Traces) MarshalJSON ¶
MarshalJSON marshals Traces model to json.
func (*Traces) UnmarshalJSON ¶
UnmarshalJSON unmarshals Traces model.
type TracesExporter ¶
type TracesExporter struct {
// contains filtered or unexported fields
}
TracesExporter will send traces to a traces instance
func (*TracesExporter) Export ¶
func (te *TracesExporter) Export(ctx context.Context, payload Payload) error
Export implements the AppDataExporter interface
func (*TracesExporter) Name ¶
func (te *TracesExporter) Name() string
Name of the exporter, for logging purposes