Documentation ¶
Index ¶
- Constants
- func False() *bool
- func NewContext(parent context.Context, cw *ContextWrapper) context.Context
- func True() *bool
- type Agent
- type Config
- type ContextWrapper
- type CustomMetric
- type HandlerWrapper
- type InvocationError
- type LoggerPluginConfig
- type Plugin
- type PluginInstantiator
- type PluginMeta
- type Report
- type ReportAWS
- type ReportDisk
- type ReportEnvironment
- type ReportEnvironmentAgent
- type ReportEnvironmentHost
- type ReportEnvironmentOS
- type ReportEnvironmentOSCPU
- type ReportEnvironmentOSCPUTimes
- type ReportEnvironmentOSLinux
- type ReportEnvironmentOSLinuxPID
- type ReportEnvironmentOSLinuxPIDSelf
- type ReportEnvironmentOSLinuxPIDSelfStat
- type ReportEnvironmentOSLinuxPIDSelfStatus
- type ReportEnvironmentRuntime
- type Reporter
- type TestPluginConfig
- type UUID
Constants ¶
const ( // VERSION is the version of the IOpipe agent VERSION = "0.1.1" // RUNTIME is the runtime of the IOpipe agent RUNTIME = "go" )
const HookPostInvoke = "post:invoke"
HookPostInvoke is a hook run after an invocation
const HookPostReport = "post:report"
HookPostReport is a hook run after reporting
const HookPostSetup = "post:setup"
HookPostSetup is a hook run after agent setup
const HookPreInvoke = "pre:invoke"
HookPreInvoke is a hook run before an invocation
const HookPreReport = "pre:report"
HookPreReport is a hook run before reporting
const HookPreSetup = "pre:setup"
HookPreSetup is ahook run before agent setup
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
func NewContext(parent context.Context, cw *ContextWrapper) context.Context
NewContext returns a new Context that contains the IOpipe context wrapper
Types ¶
type Agent ¶
type Agent struct { *Config // contains filtered or unexported fields }
Agent is the IOpipe instance
func (*Agent) WrapHandler ¶
func (a *Agent) WrapHandler(handler interface{}) interface{}
WrapHandler wraps the handler with the IOpipe agent
type Config ¶
type Config struct { Debug *bool Enabled *bool PluginInstantiators []PluginInstantiator Reporter Reporter TimeoutWindow *time.Duration Token *string }
Config is the config object passed to agent initialization
type ContextWrapper ¶
type ContextWrapper struct { *lambdacontext.LambdaContext IOpipe *HandlerWrapper }
ContextWrapper wraps the AWS lambda context
func FromContext ¶
func FromContext(ctx context.Context) (*ContextWrapper, bool)
FromContext returns the context wrapper stored in ctx
func NewContextWrapper ¶
func NewContextWrapper(ctx *lambdacontext.LambdaContext, handler *HandlerWrapper) *ContextWrapper
NewContextWrapper returns a new context wrapper
type CustomMetric ¶
type CustomMetric struct { Name string `json:"name"` S interface{} `json:"s"` N interface{} `json:"n"` }
CustomMetric is a custom metric
type HandlerWrapper ¶
type HandlerWrapper struct {
// contains filtered or unexported fields
}
HandlerWrapper is the IOpipe handler wrapper
func NewHandlerWrapper ¶
func NewHandlerWrapper(handler interface{}, agent *Agent) *HandlerWrapper
NewHandlerWrapper creates a new IOpipe handler wrapper
func (*HandlerWrapper) Error ¶
func (hw *HandlerWrapper) Error(err error)
Error adds an error to the report
func (*HandlerWrapper) Invoke ¶
func (hw *HandlerWrapper) Invoke(ctx context.Context, payload interface{}) (response interface{}, err error)
Invoke invokes the wrapped handler, handling panics and timeouts
func (*HandlerWrapper) Label ¶
func (hw *HandlerWrapper) Label(name string)
Label adds a label to the report
func (*HandlerWrapper) Metric ¶
func (hw *HandlerWrapper) Metric(name string, value interface{})
Metric adds a custom metric to the report
type InvocationError ¶
type InvocationError struct { Message string `json:"message"` Name string `json:"name"` StackTrace []*panicErrorStackFrame `json:"-"` Stack string `json:"stack"` }
InvocationError is an invocation error caught by the agent
func NewInvocationError ¶
func NewInvocationError(err error) *InvocationError
NewInvocationError returns an new InvocationError
func NewPanicInvocationError ¶
func NewPanicInvocationError(err interface{}) *InvocationError
NewPanicInvocationError returns a new panic InvocationError
func (*InvocationError) Error ¶
func (h *InvocationError) Error() string
type LoggerPluginConfig ¶
type LoggerPluginConfig struct {
Key string
}
LoggerPluginConfig is the logger plugin configuration
type Plugin ¶
type Plugin interface { Meta() *PluginMeta Name() string Version() string Homepage() string Enabled() bool // Hook methods PreSetup(*Agent) PostSetup(*Agent) PreInvoke(context.Context, interface{}) PostInvoke(context.Context, interface{}) PreReport(*Report) PostReport(*Report) }
Plugin is the interface a plugin should implement
type PluginInstantiator ¶
type PluginInstantiator func() Plugin
PluginInstantiator is the function that initializes the plugin
func LoggerPlugin ¶
func LoggerPlugin(config LoggerPluginConfig) PluginInstantiator
LoggerPlugin loads the logger plugin
func TestPlugin ¶
func TestPlugin(config TestPluginConfig) PluginInstantiator
TestPlugin returns a test plugin
type PluginMeta ¶
type PluginMeta struct { Name string `json:"name"` Version string `json:"version"` Homepage string `json:"homepage"` Enabled bool `json:"enabled"` }
PluginMeta is meta data about the plugin
type Report ¶
type Report struct { ClientID string `json:"client_id"` InstallMethod string `json:"installMethod"` Duration int `json:"duration"` ProcessID string `json:"processId"` Timestamp int `json:"timestamp"` TimestampEnd int `json:"timestampEnd"` AWS *ReportAWS `json:"aws"` Disk *ReportDisk `json:"disk"` Environment *ReportEnvironment `json:"environment"` ColdStart bool `json:"coldstart"` Errors interface{} `json:"errors"` CustomMetrics []CustomMetric `json:"custom_metrics"` Labels []string `json:"labels"` Plugins []interface{} `json:"plugins"` // contains filtered or unexported fields }
Report contains an IOpipe report
func NewReport ¶
func NewReport(handler *HandlerWrapper) *Report
NewReport instantiates a new IOpipe report
type ReportAWS ¶
type ReportAWS struct { FunctionName string `json:"functionName"` FunctionVersion string `json:"functionVersion"` AWSRequestID string `json:"awsRequestId"` InvokedFunctionArn string `json:"invokedFunctionArn"` LogGroupName string `json:"logGroupName"` LogStreamName string `json:"logStreamName"` MemoryLimitInMB int `json:"memoryLimitInMB"` GetRemainingTimeInMillis int `json:"getRemainingTimeInMillis"` TraceID string `json:"traceId"` }
ReportAWS contains AWS invocation details
type ReportDisk ¶
type ReportDisk struct { TotalMiB float64 `json:"totalMiB"` UsedMiB float64 `json:"usedMiB"` UsedPercentage float64 `json:"usedPercentage"` }
ReportDisk contains disk usage information
type ReportEnvironment ¶
type ReportEnvironment struct { Agent *ReportEnvironmentAgent `json:"agent"` Host *ReportEnvironmentHost `json:"host"` OS *ReportEnvironmentOS `json:"os"` Runtime *ReportEnvironmentRuntime `json:"runtime"` }
ReportEnvironment contains environment information
type ReportEnvironmentAgent ¶
type ReportEnvironmentAgent struct { Runtime string `json:"runtime"` Version string `json:"version"` LoadTime int `json:"load_time"` }
ReportEnvironmentAgent contains information about the IOpipe agent
type ReportEnvironmentHost ¶
type ReportEnvironmentHost struct {
BootID string `json:"boot_id"`
}
ReportEnvironmentHost contains host information
type ReportEnvironmentOS ¶
type ReportEnvironmentOS struct { FreeMem uint64 `json:"freemem"` Hostname string `json:"hostname"` TotalMem uint64 `json:"totalmem"` UsedMem uint64 `json:"usedmem"` CPUs []ReportEnvironmentOSCPU `json:"cpus"` Linux *ReportEnvironmentOSLinux `json:"linux"` }
ReportEnvironmentOS contains operating system information
type ReportEnvironmentOSCPU ¶
type ReportEnvironmentOSCPU struct {
Times ReportEnvironmentOSCPUTimes `json:"times"`
}
ReportEnvironmentOSCPU contains cpu information
type ReportEnvironmentOSCPUTimes ¶
type ReportEnvironmentOSCPUTimes struct { Idle uint64 `json:"idle"` Irq uint64 `json:"irq"` Nice uint64 `json:"nice"` Sys uint64 `json:"sys"` User uint64 `json:"user"` }
ReportEnvironmentOSCPUTimes contains cpu times
type ReportEnvironmentOSLinux ¶
type ReportEnvironmentOSLinux struct {
PID *ReportEnvironmentOSLinuxPID `json:"pid"`
}
ReportEnvironmentOSLinux contains linux system information
type ReportEnvironmentOSLinuxPID ¶
type ReportEnvironmentOSLinuxPID struct {
Self *ReportEnvironmentOSLinuxPIDSelf `json:"self"`
}
ReportEnvironmentOSLinuxPID contains linux process information
type ReportEnvironmentOSLinuxPIDSelf ¶
type ReportEnvironmentOSLinuxPIDSelf struct { Stat *ReportEnvironmentOSLinuxPIDSelfStat `json:"stat"` StatStart *ReportEnvironmentOSLinuxPIDSelfStat `json:"stat_start"` Status *ReportEnvironmentOSLinuxPIDSelfStatus `json:"status"` }
ReportEnvironmentOSLinuxPIDSelf contains current process information
type ReportEnvironmentOSLinuxPIDSelfStat ¶
type ReportEnvironmentOSLinuxPIDSelfStat struct { Cstime uint64 `json:"cstime"` Cutime uint64 `json:"cutime"` Stime uint64 `json:"stime"` Utime uint64 `json:"utime"` }
ReportEnvironmentOSLinuxPIDSelfStat contains process stats
type ReportEnvironmentOSLinuxPIDSelfStatus ¶
type ReportEnvironmentOSLinuxPIDSelfStatus struct { FDSize int32 `json:"FDSize"` Threads int32 `json:"Threads"` VMRSS uint64 `json:"VmRSS"` }
ReportEnvironmentOSLinuxPIDSelfStatus contains process status
type ReportEnvironmentRuntime ¶
ReportEnvironmentRuntime contains runtime information
type TestPluginConfig ¶
type TestPluginConfig struct {
// contains filtered or unexported fields
}
TestPluginConfig is a test plugin config