Skip to content

Commit

Permalink
[chore] Rename spanstore to tracestore for v2 storage (jaegertrac…
Browse files Browse the repository at this point in the history
  • Loading branch information
mahadzaryab1 authored Dec 2, 2024
1 parent d1a8ece commit e5bb9fb
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions cmd/jaeger/internal/exporters/storageexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (

"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage"
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/sanitizer"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)

type storageExporter struct {
config *Config
logger *zap.Logger
traceWriter spanstore.Writer
traceWriter tracestore.Writer
sanitizer sanitizer.Func
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/jaeger/internal/extension/jaegerstorage/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/jaegertracing/jaeger/plugin/storage/memory"
"github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage_v2/factoryadapter"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)

var _ Extension = (*storageExt)(nil)
Expand Down Expand Up @@ -74,7 +74,7 @@ func GetMetricStorageFactory(name string, host component.Host) (storage.MetricSt
return mf, nil
}

func GetStorageFactoryV2(name string, host component.Host) (spanstore.Factory, error) {
func GetStorageFactoryV2(name string, host component.Host) (tracestore.Factory, error) {
f, err := GetStorageFactory(name, host)
if err != nil {
return nil, err
Expand Down
16 changes: 8 additions & 8 deletions storage_v2/factoryadapter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,43 @@ import (
"io"

storage_v1 "github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)

type Factory struct {
ss storage_v1.Factory
}

func NewFactory(ss storage_v1.Factory) spanstore.Factory {
func NewFactory(ss storage_v1.Factory) tracestore.Factory {
return &Factory{
ss: ss,
}
}

// Initialize implements spanstore.Factory.
// Initialize implements tracestore.Factory.
func (*Factory) Initialize(_ context.Context) error {
panic("not implemented")
}

// Close implements spanstore.Factory.
// Close implements tracestore.Factory.
func (f *Factory) Close(_ context.Context) error {
if closer, ok := f.ss.(io.Closer); ok {
return closer.Close()
}
return nil
}

// CreateTraceReader implements spanstore.Factory.
func (f *Factory) CreateTraceReader() (spanstore.Reader, error) {
// CreateTraceReader implements tracestore.Factory.
func (f *Factory) CreateTraceReader() (tracestore.Reader, error) {
spanReader, err := f.ss.CreateSpanReader()
if err != nil {
return nil, err
}
return NewTraceReader(spanReader), nil
}

// CreateTraceWriter implements spanstore.Factory.
func (f *Factory) CreateTraceWriter() (spanstore.Writer, error) {
// CreateTraceWriter implements tracestore.Factory.
func (f *Factory) CreateTraceWriter() (tracestore.Writer, error) {
spanWriter, err := f.ss.CreateSpanWriter()
if err != nil {
return nil, err
Expand Down
16 changes: 8 additions & 8 deletions storage_v2/factoryadapter/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"

spanstore_v1 "github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
"github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)

var errV1ReaderNotAvailable = errors.New("spanstore.Reader is not a wrapper around v1 reader")

type TraceReader struct {
spanReader spanstore_v1.Reader
spanReader spanstore.Reader
}

func GetV1Reader(reader spanstore.Reader) (spanstore_v1.Reader, error) {
func GetV1Reader(reader tracestore.Reader) (spanstore.Reader, error) {
if tr, ok := reader.(*TraceReader); ok {
return tr.spanReader, nil
}
return nil, errV1ReaderNotAvailable
}

func NewTraceReader(spanReader spanstore_v1.Reader) *TraceReader {
func NewTraceReader(spanReader spanstore.Reader) *TraceReader {
return &TraceReader{
spanReader: spanReader,
}
Expand All @@ -41,14 +41,14 @@ func (*TraceReader) GetServices(_ context.Context) ([]string, error) {
panic("not implemented")
}

func (*TraceReader) GetOperations(_ context.Context, _ spanstore.OperationQueryParameters) ([]spanstore.Operation, error) {
func (*TraceReader) GetOperations(_ context.Context, _ tracestore.OperationQueryParameters) ([]tracestore.Operation, error) {
panic("not implemented")
}

func (*TraceReader) FindTraces(_ context.Context, _ spanstore.TraceQueryParameters) ([]ptrace.Traces, error) {
func (*TraceReader) FindTraces(_ context.Context, _ tracestore.TraceQueryParameters) ([]ptrace.Traces, error) {
panic("not implemented")
}

func (*TraceReader) FindTraceIDs(_ context.Context, _ spanstore.TraceQueryParameters) ([]pcommon.TraceID, error) {
func (*TraceReader) FindTraceIDs(_ context.Context, _ tracestore.TraceQueryParameters) ([]pcommon.TraceID, error) {
panic("not implemented")
}
14 changes: 7 additions & 7 deletions storage_v2/factoryadapter/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"go.opentelemetry.io/collector/pdata/ptrace"

"github.com/jaegertracing/jaeger/plugin/storage/memory"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)

func TestGetV1Reader_NoError(t *testing.T) {
Expand All @@ -35,15 +35,15 @@ func (*fakeReader) GetServices(_ context.Context) ([]string, error) {
panic("not implemented")
}

func (*fakeReader) GetOperations(_ context.Context, _ spanstore.OperationQueryParameters) ([]spanstore.Operation, error) {
func (*fakeReader) GetOperations(_ context.Context, _ tracestore.OperationQueryParameters) ([]tracestore.Operation, error) {
panic("not implemented")
}

func (*fakeReader) FindTraces(_ context.Context, _ spanstore.TraceQueryParameters) ([]ptrace.Traces, error) {
func (*fakeReader) FindTraces(_ context.Context, _ tracestore.TraceQueryParameters) ([]ptrace.Traces, error) {
panic("not implemented")
}

func (*fakeReader) FindTraceIDs(_ context.Context, _ spanstore.TraceQueryParameters) ([]pcommon.TraceID, error) {
func (*fakeReader) FindTraceIDs(_ context.Context, _ tracestore.TraceQueryParameters) ([]pcommon.TraceID, error) {
panic("not implemented")
}

Expand Down Expand Up @@ -76,7 +76,7 @@ func TestTraceReader_GetOperationsPanics(t *testing.T) {
}
require.Panics(
t,
func() { traceReader.GetOperations(context.Background(), spanstore.OperationQueryParameters{}) },
func() { traceReader.GetOperations(context.Background(), tracestore.OperationQueryParameters{}) },
)
}

Expand All @@ -87,7 +87,7 @@ func TestTraceReader_FindTracesPanics(t *testing.T) {
}
require.Panics(
t,
func() { traceReader.FindTraces(context.Background(), spanstore.TraceQueryParameters{}) },
func() { traceReader.FindTraces(context.Background(), tracestore.TraceQueryParameters{}) },
)
}

Expand All @@ -98,6 +98,6 @@ func TestTraceReader_FindTraceIDsPanics(t *testing.T) {
}
require.Panics(
t,
func() { traceReader.FindTraceIDs(context.Background(), spanstore.TraceQueryParameters{}) },
func() { traceReader.FindTraceIDs(context.Background(), tracestore.TraceQueryParameters{}) },
)
}
10 changes: 5 additions & 5 deletions storage_v2/factoryadapter/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import (
otlp2jaeger "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger"
"go.opentelemetry.io/collector/pdata/ptrace"

spanstore_v1 "github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
"github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)

type TraceWriter struct {
spanWriter spanstore_v1.Writer
spanWriter spanstore.Writer
}

func NewTraceWriter(spanWriter spanstore_v1.Writer) spanstore.Writer {
func NewTraceWriter(spanWriter spanstore.Writer) tracestore.Writer {
return &TraceWriter{
spanWriter: spanWriter,
}
}

// WriteTraces implements spanstore.Writer.
// WriteTraces implements tracestore.Writer.
func (t *TraceWriter) WriteTraces(ctx context.Context, td ptrace.Traces) error {
batches := otlp2jaeger.ProtoFromTraces(td)
var errs []error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package spanstore
package tracestore

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package spanstore
package tracestore

import (
"github.com/jaegertracing/jaeger/storage_v2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package spanstore
package tracestore

import (
"context"
Expand All @@ -10,11 +10,11 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"

spanstore_v1 "github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage/spanstore"
)

// ErrTraceNotFound is returned by Reader's GetTrace if no data is found for given trace ID.
var ErrTraceNotFound = spanstore_v1.ErrTraceNotFound
var ErrTraceNotFound = spanstore.ErrTraceNotFound

// Reader finds and loads traces and other data from storage.
type Reader interface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package spanstore
package tracestore

import (
"context"
Expand Down

0 comments on commit e5bb9fb

Please sign in to comment.