Skip to content

Commit

Permalink
Drop V2 Suffix
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Dec 31, 2024
1 parent 529bcda commit 806a265
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
40 changes: 20 additions & 20 deletions cmd/query/app/querysvc/v2/querysvc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const (
defaultMaxClockSkewAdjust = time.Second
)

// QueryServiceOptionsV2 holds the configuration options for the V2 QueryService.
type QueryServiceOptionsV2 struct {
// QueryServiceOptions holds the configuration options for the query service.
type QueryServiceOptions struct {
// ArchiveTraceReader is used to read archived traces from the storage.
ArchiveTraceReader tracestore.Reader
// ArchiveTraceWriter is used to write traces to the archive storage.
Expand All @@ -44,36 +44,36 @@ type StorageCapabilities struct {
// SupportTagFilter bool
}

// QueryServiceV2 provides methods to query data from the storage.
type QueryServiceV2 struct {
// QueryService provides methods to query data from the storage.
type QueryService struct {
traceReader tracestore.Reader
dependencyReader depstore.Reader
options QueryServiceOptionsV2
options QueryServiceOptions
}

// GetTraceParams defines the parameters for retrieving traces using the GetTraces function.
type GetTraceParams struct {
// TraceIDs is a slice of trace identifiers to fetch.
TraceIDs []tracestore.GetTraceParams
// RawTraces indicates whether to retrieve raw traces.
// If set to false, the traces will be adjusted using QueryServiceOptionsV2.Adjuster.
// If set to false, the traces will be adjusted using QueryServiceOptions.Adjuster.
RawTraces bool
}

// TraceQueryParams represents the parameters for querying a batch of traces.
type TraceQueryParams struct {
tracestore.TraceQueryParams
// RawTraces indicates whether to retrieve raw traces.
// If set to false, the traces will be adjusted using QueryServiceOptionsV2.Adjuster.
// If set to false, the traces will be adjusted using QueryServiceOptions.Adjuster.
RawTraces bool
}

func NewQueryServiceV2(
func NewQueryService(
traceReader tracestore.Reader,
dependencyReader depstore.Reader,
options QueryServiceOptionsV2,
) *QueryServiceV2 {
qsvc := &QueryServiceV2{
options QueryServiceOptions,
) *QueryService {
qsvc := &QueryService{
traceReader: traceReader,
dependencyReader: dependencyReader,
options: options,
Expand All @@ -89,7 +89,7 @@ func NewQueryServiceV2(
// GetTraces retrieves traces with given trace IDs from the primary reader,
// and if any of them are not found it then queries the archive reader.
// The iterator is single-use: once consumed, it cannot be used again.
func (qs QueryServiceV2) GetTraces(
func (qs QueryService) GetTraces(
ctx context.Context,
params GetTraceParams,
) iter.Seq2[[]ptrace.Traces, error] {
Expand All @@ -111,18 +111,18 @@ func (qs QueryServiceV2) GetTraces(
}
}

func (qs QueryServiceV2) GetServices(ctx context.Context) ([]string, error) {
func (qs QueryService) GetServices(ctx context.Context) ([]string, error) {
return qs.traceReader.GetServices(ctx)
}

func (qs QueryServiceV2) GetOperations(
func (qs QueryService) GetOperations(
ctx context.Context,
query tracestore.OperationQueryParams,
) ([]tracestore.Operation, error) {
return qs.traceReader.GetOperations(ctx, query)
}

func (qs QueryServiceV2) FindTraces(
func (qs QueryService) FindTraces(
ctx context.Context,
query TraceQueryParams,
) iter.Seq2[[]ptrace.Traces, error] {
Expand All @@ -135,7 +135,7 @@ func (qs QueryServiceV2) FindTraces(
// ArchiveTrace archives a trace specified by the given query parameters.
// If the ArchiveTraceWriter is not configured, it returns
// an error indicating that there is no archive span storage available.
func (qs QueryServiceV2) ArchiveTrace(ctx context.Context, query tracestore.GetTraceParams) error {
func (qs QueryService) ArchiveTrace(ctx context.Context, query tracestore.GetTraceParams) error {
if qs.options.ArchiveTraceWriter == nil {
return errNoArchiveSpanStorage
}
Expand All @@ -159,24 +159,24 @@ func (qs QueryServiceV2) ArchiveTrace(ctx context.Context, query tracestore.GetT
return archiveErr
}

func (qs QueryServiceV2) GetDependencies(ctx context.Context, endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) {
func (qs QueryService) GetDependencies(ctx context.Context, endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) {
return qs.dependencyReader.GetDependencies(ctx, depstore.QueryParameters{
StartTime: endTs.Add(-lookback),
EndTime: endTs,
})
}

func (qs QueryServiceV2) GetCapabilities() StorageCapabilities {
func (qs QueryService) GetCapabilities() StorageCapabilities {
return StorageCapabilities{
ArchiveStorage: qs.options.hasArchiveStorage(),
}
}

func (opts *QueryServiceOptionsV2) hasArchiveStorage() bool {
func (opts *QueryServiceOptions) hasArchiveStorage() bool {
return opts.ArchiveTraceReader != nil && opts.ArchiveTraceWriter != nil
}

func (qs QueryServiceV2) receiveTraces(
func (qs QueryService) receiveTraces(
seq iter.Seq2[[]ptrace.Traces, error],
yield func([]ptrace.Traces, error) bool,
rawTraces bool,
Expand Down
12 changes: 6 additions & 6 deletions cmd/query/app/querysvc/v2/querysvc/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ var (
)

type testQueryService struct {
queryService *QueryServiceV2
queryService *QueryService
traceReader *tracestoremocks.Reader
depsReader *depstoremocks.Reader

archiveTraceReader *tracestoremocks.Reader
archiveTraceWriter *tracestoremocks.Writer
}

type testOption func(*testQueryService, *QueryServiceOptionsV2)
type testOption func(*testQueryService, *QueryServiceOptions)

func withArchiveTraceReader() testOption {
return func(tqs *testQueryService, options *QueryServiceOptionsV2) {
return func(tqs *testQueryService, options *QueryServiceOptions) {
r := &tracestoremocks.Reader{}
tqs.archiveTraceReader = r
options.ArchiveTraceReader = r
}
}

func withArchiveTraceWriter() testOption {
return func(tqs *testQueryService, options *QueryServiceOptionsV2) {
return func(tqs *testQueryService, options *QueryServiceOptions) {
r := &tracestoremocks.Writer{}
tqs.archiveTraceWriter = r
options.ArchiveTraceWriter = r
Expand All @@ -62,7 +62,7 @@ func initializeTestService(opts ...testOption) *testQueryService {
traceReader := &tracestoremocks.Reader{}
dependencyStorage := &depstoremocks.Reader{}

options := QueryServiceOptionsV2{}
options := QueryServiceOptions{}

tqs := testQueryService{
traceReader: traceReader,
Expand All @@ -73,7 +73,7 @@ func initializeTestService(opts ...testOption) *testQueryService {
opt(&tqs, &options)
}

tqs.queryService = NewQueryServiceV2(traceReader, dependencyStorage, options)
tqs.queryService = NewQueryService(traceReader, dependencyStorage, options)
return &tqs
}

Expand Down

0 comments on commit 806a265

Please sign in to comment.