trace

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TraceIDAnnotationKey = "lighthouse.jenkins-x.io/traceID"
	SpanIDAnnotationKey  = "lighthouse.jenkins-x.io/spanID"
)

Variables

View Source
var (
	ErrEventTraceNotFound  = errors.New("the EventTrace could not be found in the Store")
	ErrGitopsTraceNotFound = errors.New("the GitopsTrace could not be found in the Store")
)
View Source
var (
	ErrParentEntityNotFound = errors.New("the parent entity could not be found")
)
View Source
var (
	ErrTraceNotFound = errors.New("The Trace parent/state could not be found in the annotations")
)

Functions

This section is empty.

Types

type BaseResourceEventHandler

type BaseResourceEventHandler struct {
	Store        *Store
	SpanExporter exporttrace.SpanExporter
	Logger       *logrus.Logger
}

func (BaseResourceEventHandler) TracerProviderFor

func (h BaseResourceEventHandler) TracerProviderFor(attrs ...attribute.KeyValue) trace.TracerProvider

type Controller

type Controller struct {
	KubeConfig            *rest.Config
	Namespace             string
	ResyncInterval        time.Duration
	ChildPullRequestDelay time.Duration
	SpanExporter          exporttrace.SpanExporter
	LighthouseHandler     *lighthouse.Handler
	Logger                *logrus.Logger
}

func (*Controller) Start

func (c *Controller) Start(ctx context.Context) error

type Entity

type Entity struct {
	Type EntityType
	Name string
}

func ObjectReferenceToEntity

func ObjectReferenceToEntity(objectRef v1.ObjectReference) *Entity

type EntityType

type EntityType int
const (
	EntityTypeNone EntityType = iota
	EntityTypeLighthouseJob
	EntityTypeJxPipelineActivity
	EntityTypeTknPipelineRun
	EntityTypeTknTaskRun
	EntityTypeKubePod
	EntityTypeKubeEvent
)

type EventSpan added in v0.1.0

type EventSpan struct {
	trace.Span
	Entity Entity
}

type EventTrace

type EventTrace struct {
	EventGUID string
	RootSpan  trace.Span
	// contains filtered or unexported fields
}

func NewEventTrace

func NewEventTrace(eventGUID string, rootSpan trace.Span) *EventTrace

func (*EventTrace) AddSpan

func (t *EventTrace) AddSpan(span EventSpan)

func (EventTrace) EndRootSpanIfNeeded

func (t EventTrace) EndRootSpanIfNeeded(options ...trace.SpanOption)

func (EventTrace) FindSpanFor

func (t EventTrace) FindSpanFor(entityType EntityType, entityName string) (EventSpan, bool)

func (EventTrace) GetSpan

func (t EventTrace) GetSpan(spanID trace.SpanID) (EventSpan, bool)

type Events

type Events []*v1.Event

func (Events) FirstMatchingEvent

func (e Events) FirstMatchingEvent(reason string, fieldPaths ...string) *v1.Event

type GitopsSpan added in v0.1.0

type GitopsSpan struct {
	trace.Span
	PullRequest       PullRequest
	PullRequestClosed *time.Time
	ParentSpanID      trace.SpanID
}

type GitopsTrace added in v0.1.0

type GitopsTrace struct {
	// contains filtered or unexported fields
}

func NewGitopsTrace added in v0.1.0

func NewGitopsTrace(rootSpan GitopsSpan) *GitopsTrace

func (*GitopsTrace) AddSpan added in v0.1.0

func (t *GitopsTrace) AddSpan(span GitopsSpan)

func (GitopsTrace) GetSpan added in v0.1.0

func (t GitopsTrace) GetSpan(spanID trace.SpanID) (*GitopsSpan, bool)

func (GitopsTrace) GetSpanFor added in v0.1.0

func (t GitopsTrace) GetSpanFor(pr PullRequest) (*GitopsSpan, bool)

func (*GitopsTrace) IterateOnGitopsSpans added in v0.1.0

func (t *GitopsTrace) IterateOnGitopsSpans(callback func(gitopsSpan *GitopsSpan))

func (GitopsTrace) RootSpan added in v0.1.0

func (t GitopsTrace) RootSpan() *GitopsSpan

func (*GitopsTrace) SpanChildren added in v0.1.0

func (t *GitopsTrace) SpanChildren(spanID trace.SpanID) []*GitopsSpan

type JenkinsXPipelineActivityHandler

type JenkinsXPipelineActivityHandler struct {
	BaseResourceEventHandler
	Tracer                 trace.Tracer
	PipelineActivityClient jenkinsiov1.PipelineActivityInterface
}

func (*JenkinsXPipelineActivityHandler) OnAdd

func (h *JenkinsXPipelineActivityHandler) OnAdd(obj interface{})

func (*JenkinsXPipelineActivityHandler) OnDelete

func (h *JenkinsXPipelineActivityHandler) OnDelete(obj interface{})

func (*JenkinsXPipelineActivityHandler) OnUpdate

func (h *JenkinsXPipelineActivityHandler) OnUpdate(oldObj, newObj interface{})

type KubeEvents

type KubeEvents struct {
	Events map[string]*v1.Event
	Names  []string
	// contains filtered or unexported fields
}

func (*KubeEvents) AddEvent

func (e *KubeEvents) AddEvent(event *v1.Event)

func (*KubeEvents) GetOrderedEvents

func (e *KubeEvents) GetOrderedEvents() []*v1.Event

type KubernetesEventHandler

type KubernetesEventHandler struct {
	BaseResourceEventHandler
}

func (*KubernetesEventHandler) OnAdd

func (h *KubernetesEventHandler) OnAdd(obj interface{})

func (*KubernetesEventHandler) OnDelete

func (h *KubernetesEventHandler) OnDelete(obj interface{})

func (*KubernetesEventHandler) OnUpdate

func (h *KubernetesEventHandler) OnUpdate(oldObj, newObj interface{})

type KubernetesPodHandler

type KubernetesPodHandler struct {
	BaseResourceEventHandler
	Tracer    trace.Tracer
	PodClient kv1.PodInterface
}

func (*KubernetesPodHandler) OnAdd

func (h *KubernetesPodHandler) OnAdd(obj interface{})

func (*KubernetesPodHandler) OnDelete

func (h *KubernetesPodHandler) OnDelete(obj interface{})

func (*KubernetesPodHandler) OnUpdate

func (h *KubernetesPodHandler) OnUpdate(oldObj, newObj interface{})

type LighthouseEventHandler

type LighthouseEventHandler struct {
	BaseResourceEventHandler
	Tracer trace.Tracer
}

type LighthouseJobHandler

type LighthouseJobHandler struct {
	BaseResourceEventHandler
	Tracer              trace.Tracer
	LighthouseJobClient lighthousev1alpha1.LighthouseJobInterface
}

func (*LighthouseJobHandler) OnAdd

func (h *LighthouseJobHandler) OnAdd(obj interface{})

func (*LighthouseJobHandler) OnDelete

func (h *LighthouseJobHandler) OnDelete(obj interface{})

func (*LighthouseJobHandler) OnUpdate

func (h *LighthouseJobHandler) OnUpdate(oldObj, newObj interface{})

type LighthousePullRequestHandler added in v0.1.0

type LighthousePullRequestHandler struct {
	BaseResourceEventHandler
	Tracer                trace.Tracer
	ChildPullRequestDelay time.Duration
}

func (*LighthousePullRequestHandler) Start added in v0.1.0

func (h *LighthousePullRequestHandler) Start(stopCh <-chan struct{})

type PullRequest added in v0.1.0

type PullRequest struct {
	Owner  string
	Repo   string
	Number string
}

func (PullRequest) String added in v0.1.0

func (p PullRequest) String() string

type Store

type Store struct {
	LighthouseJobClient      lighthousev1alpha1.LighthouseJobInterface
	JxPipelineActivityClient jenkinsiov1.PipelineActivityInterface
	TknPipelineRunClient     tektonv1beta1.PipelineRunInterface
	TknTaskRunClient         tektonv1beta1.TaskRunInterface
	KubePodClient            kv1.PodInterface
	FallbackTimeout          time.Duration
	Logger                   *logrus.Logger
	// contains filtered or unexported fields
}

func NewStore

func NewStore() *Store

func (*Store) AddEventTrace

func (s *Store) AddEventTrace(eventTrace *EventTrace)

func (*Store) AddGitopsTrace added in v0.1.0

func (s *Store) AddGitopsTrace(gitopsTrace GitopsTrace)

func (*Store) AddJxPipelineActivity

func (s *Store) AddJxPipelineActivity(pa *jxv1.PipelineActivity)

func (*Store) AddKubeEvent

func (s *Store) AddKubeEvent(event *v1.Event)

func (*Store) AddKubePod

func (s *Store) AddKubePod(pod *v1.Pod)

func (*Store) AddLighthouseJob

func (s *Store) AddLighthouseJob(job *lhv1alpha1.LighthouseJob)

func (*Store) AddTknPipelineRun

func (s *Store) AddTknPipelineRun(pr *tknv1beta1.PipelineRun)

func (*Store) AddTknTaskRun

func (s *Store) AddTknTaskRun(tr *tknv1beta1.TaskRun)

func (*Store) CollectGarbage

func (s *Store) CollectGarbage()

func (*Store) DeleteJxPipelineActivity

func (s *Store) DeleteJxPipelineActivity(paName string)

func (*Store) DeleteKubeEventsFor

func (s *Store) DeleteKubeEventsFor(entity Entity)

func (*Store) DeleteKubePod

func (s *Store) DeleteKubePod(podName string)

func (*Store) DeleteLighthouseJob

func (s *Store) DeleteLighthouseJob(jobName string)

func (*Store) DeleteTknPipelineRun

func (s *Store) DeleteTknPipelineRun(prName string)

func (*Store) DeleteTknTaskRun

func (s *Store) DeleteTknTaskRun(trName string)

func (*Store) FindEventTraceByEventGUID

func (s *Store) FindEventTraceByEventGUID(eventGUID string) (*EventTrace, error)

func (*Store) FindGitopsTraceAndSpan added in v0.1.0

func (s *Store) FindGitopsTraceAndSpan(pr PullRequest) (*GitopsTrace, *GitopsSpan, error)

func (*Store) FindLighthouseJob

func (s *Store) FindLighthouseJob(labels map[string]string) *lhv1alpha1.LighthouseJob

func (*Store) GetEventTrace

func (s *Store) GetEventTrace(traceID trace.TraceID) (*EventTrace, error)

func (*Store) GetJxPipelineActivity

func (s *Store) GetJxPipelineActivity(paName string) *jxv1.PipelineActivity

func (*Store) GetKubeEventsFor

func (s *Store) GetKubeEventsFor(entity Entity) []*v1.Event

func (*Store) GetKubePod

func (s *Store) GetKubePod(podName string) *v1.Pod

func (*Store) GetTknPipelineRun

func (s *Store) GetTknPipelineRun(prName string) *tknv1beta1.PipelineRun

func (*Store) GetTknTaskRun

func (s *Store) GetTknTaskRun(trName string) *tknv1beta1.TaskRun

func (*Store) IterateOnGitopsTraces added in v0.1.0

func (s *Store) IterateOnGitopsTraces(callback func(gitopsTrace *GitopsTrace))

type TektonPipelineRunHandler

type TektonPipelineRunHandler struct {
	BaseResourceEventHandler
	Tracer            trace.Tracer
	PipelineRunClient tektonv1beta1.PipelineRunInterface
}

func (*TektonPipelineRunHandler) OnAdd

func (h *TektonPipelineRunHandler) OnAdd(obj interface{})

func (*TektonPipelineRunHandler) OnDelete

func (h *TektonPipelineRunHandler) OnDelete(obj interface{})

func (*TektonPipelineRunHandler) OnUpdate

func (h *TektonPipelineRunHandler) OnUpdate(oldObj, newObj interface{})

type TektonTaskRunHandler

type TektonTaskRunHandler struct {
	BaseResourceEventHandler
	Tracer        trace.Tracer
	TaskRunClient tektonv1beta1.TaskRunInterface
}

func (*TektonTaskRunHandler) OnAdd

func (h *TektonTaskRunHandler) OnAdd(obj interface{})

func (*TektonTaskRunHandler) OnDelete

func (h *TektonTaskRunHandler) OnDelete(obj interface{})

func (*TektonTaskRunHandler) OnUpdate

func (h *TektonTaskRunHandler) OnUpdate(oldObj, newObj interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL