Documentation ¶
Index ¶
- Constants
- func EqualsField(rField reflect.StructField, fieldName string) bool
- func HandleCrash()
- func InitKubeSpanWatcher(cluster string, otlpAddr string) error
- func InjectHelperFuncToLua(L *lua.LState)
- func Loader(L *lua.LState) int
- func ParseJsonAndProtoTag(tag reflect.StructTag) []string
- func RegisterLuaHelperFunc(name string, helper func(L *lua.LState) int)
- func SpanToSpanID(name string) trace.SpanID
- func UIDToTraceID(uid string) trace.TraceID
- type ExtraProperty
- type ExtraPropertyConfig
- type Field
- type FieldRef
- type HyperEvent
- type LifeFlag
- type LuaFetcher
- type LuaMatcher
- type ResourceSpanConfig
- func (r *ResourceSpanConfig) GetExtraPropertyNames() []string
- func (r *ResourceSpanConfig) Initial(object runtime.Object, uid string, properties utils.ConcurrentMap) (map[string]string, map[string]*Span)
- func (r *ResourceSpanConfig) IsFinishToTrack(ev *shares.AuditEvent) bool
- func (r *ResourceSpanConfig) IsStartToTrack(ev *shares.AuditEvent) bool
- type ResourceSpanConfigList
- type Span
- type SpanConfig
- type SpanMeta
- type SpanMode
- type SpanOwner
- type SpanProcessor
- type TraceErrorHandler
- type Writer
- type XSearchWriter
Constants ¶
View Source
const ( StartFinish SpanMode = "start-finish" DirectInfo SpanMode = "direct-info" CustomOwner SpanOwner = "custom" K8sOwner SpanOwner = "k8s" OthersOwner SpanOwner = "others" )
View Source
const ( SpanAnalysisFeature = "SpanAnalysisFeature" SpanIndex = "spans_consuming" SpanDocType = "_doc" JaegerFeature = "JaegerFeature" )
Variables ¶
This section is empty.
Functions ¶
func EqualsField ¶
func EqualsField(rField reflect.StructField, fieldName string) bool
对比字段的tag与给定的field是否想等
func HandleCrash ¶
func HandleCrash()
func InitKubeSpanWatcher ¶
actually cluster is not necessary
func InjectHelperFuncToLua ¶
func ParseJsonAndProtoTag ¶
获取字段的tag,支持json和protobuf两种tag设置
func RegisterLuaHelperFunc ¶
func SpanToSpanID ¶
func UIDToTraceID ¶
Types ¶
type ExtraProperty ¶
type ExtraPropertyConfig ¶
type ExtraPropertyConfig struct { Name string `json:"Name,omitempty"` ValueRex string `json:"ValueRex,omitempty"` //json path to Value ValueFetcher *LuaFetcher `json:"ValueFetcher,omitempty"` //json path to Value NeedMetric bool `json:"NeedMetric,omitempty"` //is need metric }
type FieldRef ¶
type FieldRef struct { FieldSelector string `json:"fieldSelector,omitempty"` FieldPaths []*Field `json:"-"` PathDelimiter string `json:"pathDelimiter,omitempty"` }
func NewFieldRef ¶
type HyperEvent ¶
type HyperEvent struct { Type shares.AuditType `json:"Type,omitempty"` NameRex string `json:"NameRex,omitempty"` DurationRex string `json:"DurationRex,omitempty"` Operation string `json:"Operation,omitempty"` Reason string `json:"Reason,omitempty"` LuaMatcher *LuaMatcher `json:"LuaMatcher,omitempty"` }
func (*HyperEvent) GetDuration ¶
func (h *HyperEvent) GetDuration(event *shares.AuditEvent) time.Duration
func (*HyperEvent) GetName ¶
func (h *HyperEvent) GetName(event *shares.AuditEvent) map[string]bool
func (*HyperEvent) Match ¶
func (h *HyperEvent) Match(event *shares.AuditEvent, spanName *string) (bool, time.Duration)
type LifeFlag ¶
type LifeFlag struct { StartName *string `json:"StartName,omitempty"` FinishName *string `json:"FinishName,omitempty"` StartEvent []*HyperEvent `json:"StartEvent,omitempty"` FinishEvent []*HyperEvent `json:"FinishEvent,omitempty"` }
type LuaFetcher ¶
type LuaFetcher struct {
Scripts string `json:"Scripts,omitempty"`
}
type LuaMatcher ¶
type LuaMatcher struct {
Scripts string `json:"Scripts,omitempty"`
}
type ResourceSpanConfig ¶
type ResourceSpanConfig struct { ObjectRef *audit.ObjectReference `json:"ObjectRef,omitempty"` ActionType string `json:"ActionType,omitempty"` //span计算类型 LifeFlag *LifeFlag `json:"LifeFlag,omitempty"` //标记Span的开始和结束 Spans []*SpanConfig `json:"Spans,omitempty"` ExtraProperties map[string]*ExtraPropertyConfig `json:"ExtraProperties,omitempty"` //需要提取的属性 map[name] = [json.path.to.value] }
func (*ResourceSpanConfig) GetExtraPropertyNames ¶
func (r *ResourceSpanConfig) GetExtraPropertyNames() []string
func (*ResourceSpanConfig) Initial ¶
func (r *ResourceSpanConfig) Initial(object runtime.Object, uid string, properties utils.ConcurrentMap) (map[string]string, map[string]*Span)
func (*ResourceSpanConfig) IsFinishToTrack ¶
func (r *ResourceSpanConfig) IsFinishToTrack(ev *shares.AuditEvent) bool
func (*ResourceSpanConfig) IsStartToTrack ¶
func (r *ResourceSpanConfig) IsStartToTrack(ev *shares.AuditEvent) bool
type ResourceSpanConfigList ¶
type ResourceSpanConfigList []*ResourceSpanConfig
func NewResourceSpanConfigList ¶
func NewResourceSpanConfigList() ResourceSpanConfigList
func (*ResourceSpanConfigList) GetConfigByRef ¶
func (r *ResourceSpanConfigList) GetConfigByRef(ref *audit.ObjectReference) []*ResourceSpanConfig
func (*ResourceSpanConfigList) GetExtraPropertyNames ¶
func (r *ResourceSpanConfigList) GetExtraPropertyNames() []string
type Span ¶
type Span struct { Name string Type string Begin time.Time End time.Time Elapsed int64 Cluster string ActionType string TimeStamp time.Time Omitempty bool // contains filtered or unexported fields }
func (*Span) GetConfig ¶
func (s *Span) GetConfig() *SpanConfig
func (*Span) SetConfig ¶
func (s *Span) SetConfig(sc *SpanConfig)
func (*Span) SetElapsed ¶
type SpanConfig ¶
type SpanConfig struct { Name string `json:"Name,omitempty"` // span name Type string `json:"Type,omitempty"` // span type NameRef *string `json:"NameRef,omitempty"` // json path Mode SpanMode `json:"Mode,omitempty"` DirectEvent []*HyperEvent `json:"DirectEvent,omitempty"` StartEvent []*HyperEvent `json:"StartEvent,omitempty"` EndEvent []*HyperEvent `json:"EndEvent,omitempty"` Omitempty bool `json:"Omitempty,omitempty"` SpanOwner SpanOwner `json:"SpanOwner,omitempty"` NeedClose bool `json:"NeedClose,omitempty"` // if need to close the span which does not have end time }
func (*SpanConfig) Update ¶
func (s *SpanConfig) Update(event *shares.AuditEvent, span *Span)
type SpanMeta ¶
type SpanMeta struct { ObjectRef *audit.ObjectReference Spans []*Span //properties Cluster string CreationTimestamp time.Time ExtraProperties utils.ConcurrentMap // contains filtered or unexported fields }
func NewSpanMeta ¶
func NewSpanMeta(config *ResourceSpanConfig, cluster string, createTime time.Time, event *shares.AuditEvent) *SpanMeta
func (*SpanMeta) SpanConfig ¶
func (s *SpanMeta) SpanConfig() *ResourceSpanConfig
func (*SpanMeta) TrackSpan ¶
func (s *SpanMeta) TrackSpan(event *shares.AuditEvent)
type SpanProcessor ¶
type SpanProcessor struct { Cluster string SpanMetas *sync.Map // contains filtered or unexported fields }
var ( WatcherQueue *queue.BoundedQueue DeliverySpanProcessor *SpanProcessor )
func NewSpanProcessor ¶
func NewSpanProcessor(cluster string) *SpanProcessor
func (*SpanProcessor) Compact ¶
func (p *SpanProcessor) Compact()
func (*SpanProcessor) ProcessEvent ¶
func (p *SpanProcessor) ProcessEvent(ev *shares.AuditEvent)
this function should be thread safe
func (*SpanProcessor) RefreshConfig ¶
func (p *SpanProcessor) RefreshConfig()
type TraceErrorHandler ¶
type TraceErrorHandler struct{}
func (*TraceErrorHandler) Handle ¶
func (*TraceErrorHandler) Handle(err error)
type XSearchWriter ¶
type XSearchWriter struct {
// contains filtered or unexported fields
}
func NewXSearchWriter ¶
func NewXSearchWriter() (*XSearchWriter, error)
func (*XSearchWriter) Write ¶
func (x *XSearchWriter) Write(p *SpanMeta) error
Click to show internal directories.
Click to hide internal directories.