-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
construct the storage_v2 spanstore interface structure
- Loading branch information
1 parent
43d529c
commit cd16c67
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2024 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package spanstore | ||
|
||
// Factory defines an interface for a factory that can create implementations of different storage components. | ||
// Implementations are also encouraged to implement plugin.Configurable interface. | ||
type Factory interface { | ||
// Initialize performs internal initialization of the factory, such as opening connections to the backend store. | ||
// It is called after all configuration of the factory itself has been done. | ||
Initialize() error | ||
|
||
// CreateSpanReader creates a spanstore.Reader. | ||
CreateTraceReader() (Reader, error) | ||
|
||
// CreateSpanWriter creates a spanstore.Writer. | ||
CreateTraceWriter() (Writer, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) 2024 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package spanstore | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/jaegertracing/jaeger/model" | ||
) | ||
|
||
// Reader finds and loads traces and other data from storage. | ||
type Reader interface { | ||
// GetTrace retrieves the trace with a given id. | ||
// | ||
// If no spans are stored for this trace, it returns ErrTraceNotFound. | ||
GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) | ||
|
||
// GetServices returns all service names known to the backend from spans | ||
// within its retention period. | ||
GetServices(ctx context.Context) ([]string, error) | ||
|
||
// GetOperations returns all operation names for a given service | ||
// known to the backend from spans within its retention period. | ||
GetOperations(ctx context.Context, query OperationQueryParameters) ([]Operation, error) | ||
|
||
// FindTraces returns all traces matching query parameters. There's currently | ||
// an implementation-dependent abiguity whether all query filters (such as | ||
// multiple tags) must apply to the same span within a trace, or can be satisfied | ||
// by different spans. | ||
// | ||
// If no matching traces are found, the function returns (nil, nil). | ||
FindTraces(ctx context.Context, query *TraceQueryParameters) ([]*model.Trace, error) | ||
|
||
// FindTraceIDs does the same search as FindTraces, but returns only the list | ||
// of matching trace IDs. | ||
// | ||
// If no matching traces are found, the function returns (nil, nil). | ||
FindTraceIDs(ctx context.Context, query *TraceQueryParameters) ([]model.TraceID, error) | ||
} | ||
|
||
// TraceQueryParameters contains parameters of a trace query. | ||
type TraceQueryParameters struct { | ||
ServiceName string | ||
OperationName string | ||
Tags map[string]string | ||
StartTimeMin time.Time | ||
StartTimeMax time.Time | ||
DurationMin time.Duration | ||
DurationMax time.Duration | ||
NumTraces int | ||
} | ||
|
||
// OperationQueryParameters contains parameters of query operations, empty spanKind means get operations for all kinds of span. | ||
type OperationQueryParameters struct { | ||
ServiceName string | ||
SpanKind string | ||
} | ||
|
||
// Operation contains operation name and span kind | ||
type Operation struct { | ||
Name string | ||
SpanKind string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2024 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package spanstore | ||
|
||
import ( | ||
"context" | ||
|
||
"go.opentelemetry.io/collector/pdata/ptrace" | ||
) | ||
|
||
// Writer writes spans to storage. | ||
type Writer interface { | ||
// WriteTrace writes batches of spans at once and | ||
// compatible with OTLP Exporter API. | ||
WriteTraces(ctx context.Context, td ptrace.Traces) error | ||
} |