Documentation ¶
Index ¶
- Constants
- func AddEvent(event *protocol.Event)
- func AddException(exception *protocol.Exception)
- func AddLabel(key string, value interface{})
- func GetLambdaTimeoutThresholdMs() int
- func GetTimestamp() float64
- func HandleSendTracesResponse(resp *http.Response, err error)
- func StopGlobalTracer()
- type Config
- type MockedEpsagonTracer
- func (t *MockedEpsagonTracer) AddError(errorType string, value interface{})
- func (t *MockedEpsagonTracer) AddEvent(e *protocol.Event)
- func (t *MockedEpsagonTracer) AddException(e *protocol.Exception)
- func (t *MockedEpsagonTracer) AddExceptionTypeAndMessage(exceptionType, msg string)
- func (t *MockedEpsagonTracer) AddLabel(key string, value interface{})
- func (t *MockedEpsagonTracer) GetConfig() *Config
- func (t *MockedEpsagonTracer) GetRunnerEvent() *protocol.Event
- func (t *MockedEpsagonTracer) Running() bool
- func (t *MockedEpsagonTracer) SendStopSignal()
- func (t *MockedEpsagonTracer) Start()
- func (t *MockedEpsagonTracer) Stop()
- func (t *MockedEpsagonTracer) Stopped() bool
- type Tracer
Constants ¶
const AwsServiceKey = "aws.service"
const DefaultLambdaTimeoutThresholdMs = 200
threshold in milliseconds to send the trace before a Lambda timeout occurs
const DefaultMaxTraceSize = DefaultMaxTraceSizeKB * 1024
DefaultMaxTraceSize is the default maximum trace size (in bytes)
const DefaultMaxTraceSizeKB = 64
DefaultMaxTraceSizeKB is the default maximum trace size (in KB)
const EpsagonHTTPTraceIDKey = "http_trace_id"
const EpsagonRequestTraceIDKey = "request_trace_id"
const IsTrimmedKey = "is_trimmed"
const LabelsKey = "labels"
LabelsKey is the key for labels in resource metadata
const MaxLabelsSize = 10 * 1024
MaxLabelsSize is the maximum allowed total labels size (in bytes)
const MaxTraceSize = MaxTraceSizeKB * 1024
MaxTraceSize is the maximum allowed trace size (in bytes)
const MaxTraceSizeEnvVar = "EPSAGON_MAX_TRACE_SIZE"
MaxTraceSizeEnvVar max trace size environment variable
const MaxTraceSizeKB = 512
MaxTraceSizeKB is the maximum allowed trace size (in KB)
const VERSION = "1.39.0"
VERSION is Epsagon tracer version
Variables ¶
This section is empty.
Functions ¶
func AddException ¶
AddException adds an exception to the tracer
func GetLambdaTimeoutThresholdMs ¶
func GetLambdaTimeoutThresholdMs() int
func GetTimestamp ¶
func GetTimestamp() float64
GetTimestamp returns the current time in miliseconds
func HandleSendTracesResponse ¶
HandleSendTracesResponse handles responses from the trace collector
func StopGlobalTracer ¶
func StopGlobalTracer()
StopTracer will close the tracer and send all the data to the collector
Types ¶
type Config ¶
type Config struct { ApplicationName string // Application name in Epsagon Token string // Epsgaon Token CollectorURL string // Epsagon collector url MetadataOnly bool // Only send metadata about the event Debug bool // Print Epsagon debug information SendTimeout string // Timeout for sending traces to Epsagon Disable bool // Disable sending traces TestMode bool // TestMode sending traces IgnoredKeys []string // IgnoredKeys are keys that will be masked from events metadata MaxTraceSize int // MaxTraceSize is the maximum allowed trace size (in bytes) }
Config is the configuration for Epsagon's tracer
func GetGlobalTracerConfig ¶
func GetGlobalTracerConfig() *Config
GetGlobalTracerConfig returns the configuration of the global tracer
type MockedEpsagonTracer ¶
type MockedEpsagonTracer struct { Exceptions *[]*protocol.Exception Events *[]*protocol.Event Labels map[string]interface{} RunnerException *protocol.Exception Config *Config PanicStart bool PanicAddEvent bool PanicAddException bool PanicStop bool DelayAddEvent bool DelayedEventsChan chan bool // contains filtered or unexported fields }
MockedEpsagonTracer will not send traces if closed
func (*MockedEpsagonTracer) AddError ¶
func (t *MockedEpsagonTracer) AddError(errorType string, value interface{})
AddError implements AddError
func (*MockedEpsagonTracer) AddEvent ¶
func (t *MockedEpsagonTracer) AddEvent(e *protocol.Event)
AddEvent implementes mocked AddEvent
func (*MockedEpsagonTracer) AddException ¶
func (t *MockedEpsagonTracer) AddException(e *protocol.Exception)
AddException implementes mocked AddEvent
func (*MockedEpsagonTracer) AddExceptionTypeAndMessage ¶
func (t *MockedEpsagonTracer) AddExceptionTypeAndMessage(exceptionType, msg string)
AddExceptionTypeAndMessage implements AddExceptionTypeAndMessage
func (*MockedEpsagonTracer) AddLabel ¶
func (t *MockedEpsagonTracer) AddLabel(key string, value interface{})
AddLabel implements AddLabel
func (*MockedEpsagonTracer) GetConfig ¶
func (t *MockedEpsagonTracer) GetConfig() *Config
GetConfig implementes mocked AddEvent
func (*MockedEpsagonTracer) GetRunnerEvent ¶
func (t *MockedEpsagonTracer) GetRunnerEvent() *protocol.Event
GetRunnerEvent implements AddError
func (*MockedEpsagonTracer) Running ¶
func (t *MockedEpsagonTracer) Running() bool
Running implementes mocked Running
func (*MockedEpsagonTracer) SendStopSignal ¶
func (t *MockedEpsagonTracer) SendStopSignal()
Stop implementes mocked Stop
func (*MockedEpsagonTracer) Start ¶
func (t *MockedEpsagonTracer) Start()
Start implementes mocked Start
func (*MockedEpsagonTracer) Stop ¶
func (t *MockedEpsagonTracer) Stop()
Stop implementes mocked Stop
func (*MockedEpsagonTracer) Stopped ¶
func (t *MockedEpsagonTracer) Stopped() bool
Stopped implementes mocked Stopped
type Tracer ¶
type Tracer interface { AddEvent(*protocol.Event) AddException(*protocol.Exception) AddExceptionTypeAndMessage(string, string) // AddLabel Adds a label to the trace that will be sent AddLabel(string, interface{}) // AddError Set an error to the trace that will be sent on the runner event AddError(string, interface{}) // GetRunnerEvent Returns the first event with "runner" as its Origin GetRunnerEvent() *protocol.Event // Starts the tracer event data collection Start() Running() bool // Stop the tracer collecting data and send trace SendStopSignal() // Stop the tracer collecting data and send trace, waiting // for the tracer to finish running Stop() Stopped() bool GetConfig() *Config }
Tracer is what a general program tracer has to provide
var ( // GlobalTracer A global Tracer for all internal uses GlobalTracer Tracer )
func CreateGlobalTracer ¶
CreateTracer will initiallize a global epsagon tracer
func CreateTracer ¶
CreateTracer will initiallize a new epsagon tracer