MCPcopy
hub / github.com/grafana/tempo / NewStore

Function NewStore

modules/generator/processor/servicegraphs/store/store.go:42–58  ·  view source on GitHub ↗

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.

(ttl time.Duration, maxItems int, onComplete, onExpire Callback, droppedSpanSideOverflowCounter prometheus.Counter)

Source from the content-addressed store, hash-verified

40// request between two services. Once an edge is complete its metrics can be collected. Edges that
41// have not found their pair are deleted after ttl time.
42func NewStore(ttl time.Duration, maxItems int, onComplete, onExpire Callback, droppedSpanSideOverflowCounter prometheus.Counter) Store {
43 s := &store{
44 l: list.New(),
45 m: make(map[string]*list.Element),
46 d: make(map[droppedSpanSideKey]int64),
47
48 onComplete: onComplete,
49 onExpire: onExpire,
50
51 ttl: ttl,
52 maxItems: maxItems,
53
54 droppedSpanSideOverflowCounter: droppedSpanSideOverflowCounter,
55 }
56
57 return s
58}
59
60func (s *store) len() int {
61 s.mtx.Lock()

Calls

no outgoing calls