Skip to content

Commit

Permalink
[chore] Make package naming more consistent (#6289)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- Resolves #6219 

## Description of the changes
- Perform the following package renames
  - `plugin/metrics` to `plugin/metricstore`
  - `storage/metricsstore` to `storage/metricstore`
  - `prometheus/metricsstore` to `prometheus/metricstore`
- Renames `storage.MetricsFactory` to `storage.MetricStoreFactory`

## How was this change tested?
- CI

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 authored Dec 2, 2024
1 parent 88777f5 commit d1a8ece
Show file tree
Hide file tree
Showing 45 changed files with 189 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ packages:
github.com/jaegertracing/jaeger/storage/dependencystore:
interfaces:
Reader:
github.com/jaegertracing/jaeger/storage/metricsstore:
github.com/jaegertracing/jaeger/storage/metricstore:
config:
all: true
github.com/jaegertracing/jaeger/storage/samplingstore:
Expand Down
8 changes: 4 additions & 4 deletions cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/jaegertracing/jaeger/pkg/telemetry"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/pkg/version"
metricsPlugin "github.com/jaegertracing/jaeger/plugin/metrics"
"github.com/jaegertracing/jaeger/plugin/metricstore"
ss "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider"
"github.com/jaegertracing/jaeger/plugin/storage"
"github.com/jaegertracing/jaeger/ports"
Expand Down Expand Up @@ -64,8 +64,8 @@ func main() {
log.Fatalf("Cannot initialize sampling strategy factory: %v", err)
}

fc := metricsPlugin.FactoryConfigFromEnv()
metricsReaderFactory, err := metricsPlugin.NewFactory(fc)
fc := metricstore.FactoryConfigFromEnv()
metricsReaderFactory, err := metricstore.NewFactory(fc)
if err != nil {
log.Fatalf("Cannot initialize metrics store factory: %v", err)
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func startQuery(
}

func createMetricsQueryService(
metricsReaderFactory *metricsPlugin.Factory,
metricsReaderFactory *metricstore.Factory,
v *viper.Viper,
telset telemetry.Settings,
) (querysvc.MetricsQueryService, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/anonymizer/app/query/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/jaegertracing/jaeger/cmd/query/app"
"github.com/jaegertracing/jaeger/cmd/query/app/querysvc"
"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/plugin/metrics/disabled"
"github.com/jaegertracing/jaeger/plugin/metricstore/disabled"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks"
"github.com/jaegertracing/jaeger/storage/spanstore"
Expand Down
6 changes: 3 additions & 3 deletions cmd/internal/env/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/jaegertracing/jaeger/plugin/metrics"
"github.com/jaegertracing/jaeger/plugin/metricstore"
"github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider"
"github.com/jaegertracing/jaeger/plugin/storage"
)
Expand Down Expand Up @@ -83,11 +83,11 @@ func Command() *cobra.Command {
),
)
fs.String(
metrics.StorageTypeEnvVar,
metricstore.StorageTypeEnvVar,
"",
fmt.Sprintf(
strings.ReplaceAll(metricsStorageTypeDescription, "\n", " "),
strings.Join(metrics.AllStorageTypes, ", "),
strings.Join(metricstore.AllStorageTypes, ", "),
),
)
long := fmt.Sprintf(longTemplate, strings.ReplaceAll(fs.FlagUsagesWrapped(0), " --", "\n"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (m *mockStorageExt) TraceStorageFactory(name string) (storage.Factory, bool
return nil, false
}

func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) {
func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) {
if m.name == name {
return m.metricsFactory, true
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/jaeger/internal/extension/jaegerquery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/pkg/telemetry"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/plugin/metrics/disabled"
"github.com/jaegertracing/jaeger/storage/metricsstore"
"github.com/jaegertracing/jaeger/plugin/metricstore/disabled"
"github.com/jaegertracing/jaeger/storage/metricstore"
)

var (
Expand Down Expand Up @@ -138,7 +138,7 @@ func (s *server) addArchiveStorage(opts *querysvc.QueryServiceOptions, host comp
return nil
}

func (s *server) createMetricReader(host component.Host) (metricsstore.Reader, error) {
func (s *server) createMetricReader(host component.Host) (metricstore.Reader, error) {
if s.config.Storage.Metrics == "" {
s.telset.Logger.Info("Metric storage not configured")
return disabled.NewMetricsReader()
Expand Down
10 changes: 5 additions & 5 deletions cmd/jaeger/internal/extension/jaegerquery/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/dependencystore"
depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks"
"github.com/jaegertracing/jaeger/storage/metricsstore"
metricsstoremocks "github.com/jaegertracing/jaeger/storage/metricsstore/mocks"
"github.com/jaegertracing/jaeger/storage/metricstore"
metricstoremocks "github.com/jaegertracing/jaeger/storage/metricstore/mocks"
"github.com/jaegertracing/jaeger/storage/spanstore"
spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks"
)
Expand Down Expand Up @@ -81,11 +81,11 @@ func (fmf fakeMetricsFactory) Initialize(telemetry.Settings) error {
return nil
}

func (fmf fakeMetricsFactory) CreateMetricsReader() (metricsstore.Reader, error) {
func (fmf fakeMetricsFactory) CreateMetricsReader() (metricstore.Reader, error) {
if fmf.name == "need-metrics-reader-error" {
return nil, errors.New("test-error")
}
return &metricsstoremocks.Reader{}, nil
return &metricstoremocks.Reader{}, nil
}

type fakeStorageExt struct{}
Expand All @@ -99,7 +99,7 @@ func (fakeStorageExt) TraceStorageFactory(name string) (storage.Factory, bool) {
return fakeFactory{name: name}, true
}

func (fakeStorageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) {
func (fakeStorageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) {
if name == "need-factory-error" {
return nil, false
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerstorage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
casCfg "github.com/jaegertracing/jaeger/pkg/cassandra/config"
esCfg "github.com/jaegertracing/jaeger/pkg/es/config"
promCfg "github.com/jaegertracing/jaeger/pkg/prometheus/config"
"github.com/jaegertracing/jaeger/plugin/metrics/prometheus"
"github.com/jaegertracing/jaeger/plugin/metricstore/prometheus"
"github.com/jaegertracing/jaeger/plugin/storage/badger"
"github.com/jaegertracing/jaeger/plugin/storage/cassandra"
"github.com/jaegertracing/jaeger/plugin/storage/es"
Expand Down
14 changes: 7 additions & 7 deletions cmd/jaeger/internal/extension/jaegerstorage/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/pkg/telemetry"
"github.com/jaegertracing/jaeger/plugin/metrics/prometheus"
"github.com/jaegertracing/jaeger/plugin/metricstore/prometheus"
"github.com/jaegertracing/jaeger/plugin/storage/badger"
"github.com/jaegertracing/jaeger/plugin/storage/cassandra"
"github.com/jaegertracing/jaeger/plugin/storage/es"
Expand All @@ -30,14 +30,14 @@ var _ Extension = (*storageExt)(nil)
type Extension interface {
extension.Extension
TraceStorageFactory(name string) (storage.Factory, bool)
MetricStorageFactory(name string) (storage.MetricsFactory, bool)
MetricStorageFactory(name string) (storage.MetricStoreFactory, bool)
}

type storageExt struct {
config *Config
telset component.TelemetrySettings
factories map[string]storage.Factory
metricsFactories map[string]storage.MetricsFactory
metricsFactories map[string]storage.MetricStoreFactory
}

// GetStorageFactory locates the extension in Host and retrieves
Expand All @@ -59,7 +59,7 @@ func GetStorageFactory(name string, host component.Host) (storage.Factory, error

// GetMetricStorageFactory locates the extension in Host and retrieves
// a metric storage factory from it with the given name.
func GetMetricStorageFactory(name string, host component.Host) (storage.MetricsFactory, error) {
func GetMetricStorageFactory(name string, host component.Host) (storage.MetricStoreFactory, error) {
ext, err := findExtension(host)
if err != nil {
return nil, err
Expand Down Expand Up @@ -110,7 +110,7 @@ func newStorageExt(config *Config, telset component.TelemetrySettings) *storageE
config: config,
telset: telset,
factories: make(map[string]storage.Factory),
metricsFactories: make(map[string]storage.MetricsFactory),
metricsFactories: make(map[string]storage.MetricStoreFactory),
}
}

Expand Down Expand Up @@ -175,7 +175,7 @@ func (s *storageExt) Start(_ context.Context, host component.Host) error {

for metricStorageName, cfg := range s.config.MetricBackends {
s.telset.Logger.Sugar().Infof("Initializing metrics storage '%s'", metricStorageName)
var metricsFactory storage.MetricsFactory
var metricsFactory storage.MetricStoreFactory
var err error
if cfg.Prometheus != nil {
promTelset := telset
Expand Down Expand Up @@ -211,7 +211,7 @@ func (s *storageExt) TraceStorageFactory(name string) (storage.Factory, bool) {
return f, ok
}

func (s *storageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) {
func (s *storageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) {
mf, ok := s.metricsFactories[name]
return mf, ok
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (f *PurgerFactory) Purge(_ context.Context) error {
type mockStorageExt struct {
name string
factory storage.Factory
metricsFactory storage.MetricsFactory
metricsFactory storage.MetricStoreFactory
}

func (*mockStorageExt) Start(context.Context, component.Host) error {
Expand All @@ -59,7 +59,7 @@ func (m *mockStorageExt) TraceStorageFactory(name string) (storage.Factory, bool
return nil, false
}

func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) {
func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) {
if m.name == name {
return m.metricsFactory, true
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/query/app/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
"github.com/jaegertracing/jaeger/model"
_ "github.com/jaegertracing/jaeger/pkg/gogocodec" // force gogo codec registration
"github.com/jaegertracing/jaeger/pkg/jtracer"
"github.com/jaegertracing/jaeger/plugin/metrics/disabled"
"github.com/jaegertracing/jaeger/plugin/metricstore/disabled"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
"github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics"
"github.com/jaegertracing/jaeger/storage/metricsstore"
"github.com/jaegertracing/jaeger/storage/metricstore"
"github.com/jaegertracing/jaeger/storage/spanstore"
)

Expand Down Expand Up @@ -242,7 +242,7 @@ func (g *GRPCHandler) GetLatencies(ctx context.Context, r *metrics.GetLatenciesR
if r.Quantile == 0 {
return nil, errMissingQuantile
}
queryParams := metricsstore.LatenciesQueryParameters{
queryParams := metricstore.LatenciesQueryParameters{
BaseQueryParameters: bqp,
Quantile: r.Quantile,
}
Expand All @@ -259,7 +259,7 @@ func (g *GRPCHandler) GetCallRates(ctx context.Context, r *metrics.GetCallRatesR
if err := g.handleErr("failed to build parameters", err); err != nil {
return nil, err
}
queryParams := metricsstore.CallRateQueryParameters{
queryParams := metricstore.CallRateQueryParameters{
BaseQueryParameters: bqp,
}
m, err := g.metricsQueryService.GetCallRates(ctx, &queryParams)
Expand All @@ -275,7 +275,7 @@ func (g *GRPCHandler) GetErrorRates(ctx context.Context, r *metrics.GetErrorRate
if err := g.handleErr("failed to build parameters", err); err != nil {
return nil, err
}
queryParams := metricsstore.ErrorRateQueryParameters{
queryParams := metricstore.ErrorRateQueryParameters{
BaseQueryParameters: bqp,
}
m, err := g.metricsQueryService.GetErrorRates(ctx, &queryParams)
Expand All @@ -287,7 +287,7 @@ func (g *GRPCHandler) GetErrorRates(ctx context.Context, r *metrics.GetErrorRate

// GetMinStepDuration is the gRPC handler to fetch the minimum step duration supported by the underlying metrics store.
func (g *GRPCHandler) GetMinStepDuration(ctx context.Context, _ *metrics.GetMinStepDurationRequest) (*metrics.GetMinStepDurationResponse, error) {
minStep, err := g.metricsQueryService.GetMinStepDuration(ctx, &metricsstore.MinStepDurationQueryParameters{})
minStep, err := g.metricsQueryService.GetMinStepDuration(ctx, &metricstore.MinStepDurationQueryParameters{})
if err := g.handleErr("failed to fetch min step duration", err); err != nil {
return nil, err
}
Expand All @@ -312,7 +312,7 @@ func (g *GRPCHandler) handleErr(msg string, err error) error {
return status.Errorf(codes.Internal, "%s: %v", msg, err)
}

func (g *GRPCHandler) newBaseQueryParameters(r any) (bqp metricsstore.BaseQueryParameters, err error) {
func (g *GRPCHandler) newBaseQueryParameters(r any) (bqp metricstore.BaseQueryParameters, err error) {
if r == nil {
return bqp, errNilRequest
}
Expand Down
Loading

0 comments on commit d1a8ece

Please sign in to comment.