Documentation ¶
Index ¶
- Constants
- func AddToSpan(span ddtrace.Span, events ...*Event)
- func Enabled() bool
- func GetSpanValue(events ...*Event) any
- type Event
- type EventCategory
- func (z *EventCategory) DecodeMsg(dc *msgp.Reader) (err error)
- func (z EventCategory) EncodeMsg(en *msgp.Writer) (err error)
- func (z EventCategory) MarshalMsg(b []byte) (o []byte, err error)
- func (z EventCategory) Msgsize() (s int)
- func (z *EventCategory) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Options
- type StackFrame
- type StackTrace
Constants ¶
const SpanKey = "_dd.stack"
Variables ¶
This section is empty.
Functions ¶
func AddToSpan ¶
AddToSpan adds the event to the given span's root span as a tag if stacktrace collection is enabled
func GetSpanValue ¶ added in v1.69.0
GetSpanValue returns the value to be set as a tag on a span for the given stacktrace events
Types ¶
type Event ¶
type Event struct { // Category is a well-known type of the event, not optional Category EventCategory `msg:"-"` // Type is a value event category specific, optional Type string `msg:"type,omitempty"` // Language is the language of the code that generated the event (set to "go" anyway here) Language string `msg:"language,omitempty"` // ID is the id of the event, optional for exceptions but mandatory for vulnerabilities and exploits to correlate with more data ID string `msg:"id,omitempty"` // Message is a generic message for the event Message string `msg:"message,omitempty"` // Frames is the stack trace of the event Frames StackTrace `msg:"frames"` }
Event is the toplevel structure to contain a stacktrace and the additional information needed to correlate it with other data
func NewEvent ¶
func NewEvent(eventCat EventCategory, options ...Options) *Event
NewEvent creates a new stacktrace event with the given category, type and message
func (*Event) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type EventCategory ¶
type EventCategory string
const ( // ExceptionEvent is the event type for exception events ExceptionEvent EventCategory = "exception" // VulnerabilityEvent is the event type for vulnerability events VulnerabilityEvent EventCategory = "vulnerability" // ExploitEvent is the event type for exploit events ExploitEvent EventCategory = "exploit" )
func (*EventCategory) DecodeMsg ¶
func (z *EventCategory) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (EventCategory) EncodeMsg ¶
func (z EventCategory) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (EventCategory) MarshalMsg ¶
func (z EventCategory) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (EventCategory) Msgsize ¶
func (z EventCategory) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*EventCategory) UnmarshalMsg ¶
func (z *EventCategory) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Options ¶ added in v1.65.0
type Options func(*Event)
Options is a function type to set optional parameters for the event
func WithMessage ¶ added in v1.65.0
WithMessage sets the message of the event
type StackFrame ¶
type StackFrame struct { Index uint32 `msg:"id"` // Index of the frame (0 = top of the stack) Text string `msg:"text,omitempty"` // Text version of the stackframe as a string File string `msg:"file,omitempty"` // File name where the code line is Line uint32 `msg:"line,omitempty"` // Line number in the context of the file where the code is Column uint32 `msg:"column,omitempty"` // Column where the code ran is Namespace string `msg:"namespace,omitempty"` // Namespace is the fully qualified name of the package where the code is ClassName string `msg:"class_name,omitempty"` // ClassName is the fully qualified name of the class where the line of code is Function string `msg:"function,omitempty"` // Function is the fully qualified name of the function where the line of code is }
StackFrame represents a single frame in the stack trace
func (*StackFrame) DecodeMsg ¶
func (z *StackFrame) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*StackFrame) EncodeMsg ¶
func (z *StackFrame) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*StackFrame) MarshalMsg ¶
func (z *StackFrame) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*StackFrame) Msgsize ¶
func (z *StackFrame) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*StackFrame) UnmarshalMsg ¶
func (z *StackFrame) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type StackTrace ¶
type StackTrace []StackFrame
StackTrace is intended to be sent over the span tag `_dd.stack`, the first frame is the current frame
func Capture ¶
func Capture() StackTrace
Capture create a new stack trace from the current call stack
func SkipAndCapture ¶
func SkipAndCapture(skip int) StackTrace
SkipAndCapture creates a new stack trace from the current call stack, skipping the first `skip` frames
func (*StackTrace) DecodeMsg ¶
func (z *StackTrace) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (StackTrace) EncodeMsg ¶
func (z StackTrace) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (StackTrace) MarshalMsg ¶
func (z StackTrace) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (StackTrace) Msgsize ¶
func (z StackTrace) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*StackTrace) UnmarshalMsg ¶
func (z *StackTrace) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler