Documentation ¶
Index ¶
- Constants
- Variables
- func EqualsField(rField reflect.StructField, fieldName string) bool
- func HandleCrash()
- func InitKubeTraceWatcher(cluster string, otlpAddr string) error
- func ParseJsonAndProtoTag(tag reflect.StructTag) []string
- func StringToSpanID(name string) trace.SpanID
- func StringToTraceID(name 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, globalSpans utils.ConcurrentMap, ...) (map[string]string, map[string]*Span, []*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 SpanProcessor
- type TraceErrorHandler
- type TraceInfo
- type TraceService
- type TraceStatus
Constants ¶
View Source
const ( TraceFeature = "TraceFeature" TraceContextAnnotation = "meta.lunettes.com/trace-context" )
View Source
const ( OpenTraceStatus TraceStatus = "open" ClosedTraceStatus TraceStatus = "closed" CreateDelivery string = "create" StartDelivery string = "start" StopDelivery string = "stop" )
Variables ¶
View Source
var (
WatcherQueue *queue.BoundedQueue
)
Functions ¶
func EqualsField ¶
func EqualsField(rField reflect.StructField, fieldName string) bool
对比字段的tag与给定的field是否想等
func HandleCrash ¶
func HandleCrash()
func InitKubeTraceWatcher ¶
func ParseJsonAndProtoTag ¶
获取字段的tag,支持json和protobuf两种tag设置
func StringToSpanID ¶
func StringToTraceID ¶
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"` MatchRex string `json:"MatchRex,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) IsMatchRex ¶
func (h *HyperEvent) IsMatchRex(event *shares.AuditEvent) 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, globalSpans utils.ConcurrentMap, properties utils.ConcurrentMap) (map[string]string, map[string]*Span, []*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 Children []*Span // contains filtered or unexported fields }
func (*Span) InjectAttributesToSpan ¶
func (s *Span) InjectAttributesToSpan()
func (*Span) SetElapsed ¶
func (*Span) Update ¶
func (s *Span) Update(event *shares.AuditEvent)
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 Component string `json:"Component,omitempty"` // span owner Mode SpanMode `json:"Mode,omitempty"` DirectEvent []*HyperEvent `json:"DirectEvent,omitempty"` StartEvent []*HyperEvent `json:"StartEvent,omitempty"` EndEvent []*HyperEvent `json:"EndEvent,omitempty"` Children []*SpanConfig `json:"Children,omitempty"` ErrorEvent []*HyperEvent `json:"ErrorEvent,omitempty"` Omitempty bool `json:"Omitempty,omitempty"` NeedClose bool `json:"NeedClose,omitempty"` //need to close the span which does not have end time }
func (*SpanConfig) Initial ¶
func (s *SpanConfig) Initial(object runtime.Object, globalSpans utils.ConcurrentMap) (map[string]*Span, []*Span)
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 trace.SpanContextConfig ParentSpanID trace.SpanID Begin time.Time End time.Time // contains filtered or unexported fields }
func NewSpanMeta ¶
func NewSpanMeta(config *ResourceSpanConfig, cluster string, event *shares.AuditEvent) *SpanMeta
func (*SpanMeta) Finish ¶
func (s *SpanMeta) Finish(ev *shares.AuditEvent)
func (*SpanMeta) TackSpan ¶
func (s *SpanMeta) TackSpan(event *shares.AuditEvent)
type SpanProcessor ¶
type SpanProcessor struct { Cluster string SpanMetas *sync.Map // contains filtered or unexported fields }
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 TraceInfo ¶
type TraceInfo struct { TraceID string `json:"trace_id"` ParentSpanID string `json:"parent_id"` RootSpanID string `json:"root_span_id"` DeliveryType string `json:"delivery_type"` Status TraceStatus `json:"status"` Services []*TraceService `json:"services"` StartAt string `json:"start_at"` FinishAt string `json:"finish_at"` }
type TraceService ¶
type TraceStatus ¶
type TraceStatus string
Click to show internal directories.
Click to hide internal directories.