tracetracker

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDimsToSyncSource = map[string]string{
	"container_id":       "container_id",
	"kubernetes_pod_uid": "kubernetes_pod_uid",
}

DefaultDimsToSyncSource are the default dimensions to sync correlated environment and services onto.

Functions

This section is empty.

Types

type ActiveServiceTracker

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

ActiveServiceTracker keeps track of which services are seen in the trace spans passed through ProcessSpans. It supports expiry of service names if they are not seen for a certain amount of time.

func New

func New(
	log log.Logger,
	timeout time.Duration,
	correlationClient correlations.CorrelationClient,
	hostIDDims map[string]string,
	dimsToSyncSource map[string]string,
) *ActiveServiceTracker

New creates a new initialized service tracker

func (*ActiveServiceTracker) LoadHostIDDimCorrelations

func (a *ActiveServiceTracker) LoadHostIDDimCorrelations()

LoadHostIDDimCorrelations asynchronously retrieves all known correlations from the backend for all known hostIDDims. This allows the agent to timeout and manage correlation deletions on restart.

func (*ActiveServiceTracker) ProcessTraces added in v0.94.0

func (a *ActiveServiceTracker) ProcessTraces(_ context.Context, traces ptrace.Traces)

ProcessTraces accepts a list of trace spans and uses them to update the current list of active services. This is thread-safe.

func (*ActiveServiceTracker) Purge

func (a *ActiveServiceTracker) Purge()

Purges caches on the ActiveServiceTracker

type CacheKey

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

type TimeoutCache

type TimeoutCache struct {
	sync.Mutex

	// Internal metrics
	ActiveCount int64
	PurgedCount int64
	// contains filtered or unexported fields
}

func NewTimeoutCache

func NewTimeoutCache(timeout time.Duration) *TimeoutCache

func (*TimeoutCache) Delete

func (t *TimeoutCache) Delete(key *CacheKey)

func (*TimeoutCache) GetActiveCount

func (t *TimeoutCache) GetActiveCount() int64

func (*TimeoutCache) GetPurgeable

func (t *TimeoutCache) GetPurgeable(now time.Time) []*CacheKey

func (*TimeoutCache) GetPurgedCount

func (t *TimeoutCache) GetPurgedCount() int64

func (*TimeoutCache) IsFull

func (t *TimeoutCache) IsFull() bool

returns whether the cache is full

func (*TimeoutCache) PurgeOld

func (t *TimeoutCache) PurgeOld(now time.Time, onPurge func(*CacheKey))

PurgeOld

func (*TimeoutCache) RunIfKeyDoesNotExist

func (t *TimeoutCache) RunIfKeyDoesNotExist(o *CacheKey, fn func())

RunIfKeyDoesNotExist locks and runs the supplied function if the key does not exist. Be careful not to perform cache operations inside of this function because they will deadlock

func (*TimeoutCache) SetMaxSize

func (t *TimeoutCache) SetMaxSize(max int64, now time.Time)

func (*TimeoutCache) UpdateIfExists

func (t *TimeoutCache) UpdateIfExists(o *CacheKey, now time.Time) bool

UpdateIfExists

func (*TimeoutCache) UpdateOrCreate

func (t *TimeoutCache) UpdateOrCreate(o *CacheKey, now time.Time) (isNew bool)

UpdateOrCreate

Jump to

Keyboard shortcuts

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