-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
storage.go
32 lines (25 loc) · 1.27 KB
/
storage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package groupbytraceprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor"
import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
)
// storage is an abstraction for the span storage used by the groupbytrace processor.
// Implementations should be safe for concurrent use.
type storage interface {
// createOrAppend will check whether the given trace ID is already in the storage and
// will either append the given spans to the existing record, or create a new trace with
// the given spans from trace
createOrAppend(pcommon.TraceID, ptrace.Traces) error
// get will retrieve the trace based on the given trace ID, returning nil in case a trace
// cannot be found
get(pcommon.TraceID) ([]ptrace.ResourceSpans, error)
// delete will remove the trace based on the given trace ID, returning the trace that was removed,
// or nil in case a trace cannot be found
delete(pcommon.TraceID) ([]ptrace.ResourceSpans, error)
// start gives the storage the opportunity to initialize any resources or procedures
start() error
// shutdown signals the storage that the processor is shutting down
shutdown() error
}