store

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyItems = errors.New("too many items")

Functions

This section is empty.

Types

type Callback

type Callback func(e *Edge)

type ConnectionType

type ConnectionType string
const (
	Unknown         ConnectionType = ""
	MessagingSystem ConnectionType = "messaging_system"
	Database        ConnectionType = "database"
	VirtualNode     ConnectionType = "virtual_node"
)

type Edge

type Edge struct {
	Key Key

	TraceID                            pcommon.TraceID
	ConnectionType                     ConnectionType
	ServerService, ClientService       string
	ServerLatencySec, ClientLatencySec float64

	// If either the client or the server spans have status code error,
	// the Edge will be considered as failed.
	Failed bool

	// Additional dimension to add to the metrics
	Dimensions map[string]string

	// Peer is a map of peer attributes to be used for virtual node matching
	Peer map[string]string

	// VirtualNodeLabel is an optional label to be added to the spans
	VirtualNodeLabel VirtualNodeLabel
	// contains filtered or unexported fields
}

Edge is an Edge between two nodes in the graph

type Key

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

func NewKey

func NewKey(tid pcommon.TraceID, sid pcommon.SpanID) Key

func (*Key) SpanIDIsEmpty

func (k *Key) SpanIDIsEmpty() bool

type Store

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

func NewStore

func NewStore(ttl time.Duration, maxItems int, onComplete, onExpire Callback) *Store

NewStore creates a Store to build service graphs. The store caches edges, each representing a request between two services. Once an edge is complete its metrics can be collected. Edges that have not found their pair are deleted after ttl time.

func (*Store) Expire

func (s *Store) Expire()

Expire evicts all expired items in the store.

func (*Store) Len added in v0.104.0

func (s *Store) Len() int

Len is only used for testing.

func (*Store) UpsertEdge

func (s *Store) UpsertEdge(key Key, update Callback) (isNew bool, err error)

UpsertEdge fetches an Edge from the store and updates it using the given callback. If the Edge doesn't exist yet, it creates a new one with the default TTL. If the Edge is complete after applying the callback, it's completed and removed.

type VirtualNodeLabel added in v0.104.0

type VirtualNodeLabel string
const (
	UnknownVirtualNode VirtualNodeLabel = ""
	ClientVirtualNode  VirtualNodeLabel = "client"
	ServerVirtualNode  VirtualNodeLabel = "server"
)

Jump to

Keyboard shortcuts

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