Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Prometheus factory signature #3681

Merged
merged 5 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugin/metrics/disabled/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ import (
"github.com/spf13/viper"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/storage/metricsstore"
)

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements storage.Factory that returns a Disabled metrics reader.
type Factory struct{}

Expand Down
2 changes: 2 additions & 0 deletions plugin/metrics/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
// AllStorageTypes defines all available storage backends.
var AllStorageTypes = []string{prometheusStorageType}

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements storage.Factory interface as a meta-factory for storage components.
type Factory struct {
FactoryConfig
Expand Down
9 changes: 7 additions & 2 deletions plugin/metrics/prometheus/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ import (
"github.com/spf13/viper"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/plugin"
prometheusstore "github.com/jaegertracing/jaeger/plugin/metrics/prometheus/metricsstore"
"github.com/jaegertracing/jaeger/storage/metricsstore"
)

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements storage.Factory and creates storage components backed by memory store.
type Factory struct {
options *Options
Expand All @@ -43,8 +46,10 @@ func (f *Factory) AddFlags(flagSet *flag.FlagSet) {
}

// InitFromViper implements plugin.Configurable.
func (f *Factory) InitFromViper(v *viper.Viper, logger *zap.Logger) error {
return f.options.InitFromViper(v)
func (f *Factory) InitFromViper(v *viper.Viper, logger *zap.Logger) {
if err := f.options.InitFromViper(v); err != nil {
logger.Fatal("Failed to initialize metrics storage factory", zap.Error(err))
}
}

// Initialize implements storage.MetricsFactory.
Expand Down
3 changes: 3 additions & 0 deletions plugin/sampling/strategystore/adaptive/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ import (

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
"github.com/jaegertracing/jaeger/pkg/distributedlock"
"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/samplingstore"
)

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements strategystore.Factory for an adaptive strategy store.
type Factory struct {
options *Options
Expand Down
3 changes: 3 additions & 0 deletions plugin/sampling/strategystore/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ const (
samplingTypeFile = "file"
)

// AllSamplingTypes lists all types of sampling factories.
var AllSamplingTypes = []string{samplingTypeFile, samplingTypeAdaptive}

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements strategystore.Factory interface as a meta-factory for strategy storage components.
type Factory struct {
FactoryConfig
Expand Down
3 changes: 3 additions & 0 deletions plugin/sampling/strategystore/static/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ import (
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/storage"
)

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements strategystore.Factory for a static strategy store.
type Factory struct {
options *Options
Expand Down
7 changes: 7 additions & 0 deletions plugin/storage/badger/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package badger
import (
"expvar"
"flag"
"io"
"os"
"strings"
"time"
Expand All @@ -26,6 +27,7 @@ import (
"github.com/uber/jaeger-lib/metrics"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/plugin"
depStore "github.com/jaegertracing/jaeger/plugin/storage/badger/dependencystore"
badgerStore "github.com/jaegertracing/jaeger/plugin/storage/badger/spanstore"
"github.com/jaegertracing/jaeger/storage/dependencystore"
Expand All @@ -39,6 +41,11 @@ const (
lastValueLogCleanedName = "badger_storage_valueloggc_last_run"
)

var (
_ io.Closer = (*Factory)(nil)
_ plugin.Configurable = (*Factory)(nil)
)

// Factory implements storage.Factory for Badger backend.
type Factory struct {
Options *Options
Expand Down
6 changes: 6 additions & 0 deletions plugin/storage/cassandra/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/jaegertracing/jaeger/pkg/cassandra/config"
"github.com/jaegertracing/jaeger/pkg/distributedlock"
"github.com/jaegertracing/jaeger/pkg/hostname"
"github.com/jaegertracing/jaeger/plugin"
cLock "github.com/jaegertracing/jaeger/plugin/pkg/distributedlock/cassandra"
cDepStore "github.com/jaegertracing/jaeger/plugin/storage/cassandra/dependencystore"
cSamplingStore "github.com/jaegertracing/jaeger/plugin/storage/cassandra/samplingstore"
Expand All @@ -44,6 +45,11 @@ const (
archiveStorageConfig = "cassandra-archive"
)

var (
_ io.Closer = (*Factory)(nil)
_ plugin.Configurable = (*Factory)(nil)
)

// Factory implements storage.Factory for Cassandra backend.
type Factory struct {
Options *Options
Expand Down
6 changes: 6 additions & 0 deletions plugin/storage/es/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/jaegertracing/jaeger/pkg/es"
"github.com/jaegertracing/jaeger/pkg/es/config"
"github.com/jaegertracing/jaeger/plugin"
esDepStore "github.com/jaegertracing/jaeger/plugin/storage/es/dependencystore"
"github.com/jaegertracing/jaeger/plugin/storage/es/mappings"
esSpanStore "github.com/jaegertracing/jaeger/plugin/storage/es/spanstore"
Expand All @@ -38,6 +39,11 @@ const (
archiveNamespace = "es-archive"
)

var (
_ io.Closer = (*Factory)(nil)
_ plugin.Configurable = (*Factory)(nil)
)

// Factory implements storage.Factory for Elasticsearch backend.
type Factory struct {
Options *Options
Expand Down
5 changes: 5 additions & 0 deletions plugin/storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ func AllSamplingStorageTypes() []string {
return backends
}

var (
_ io.Closer = (*Factory)(nil)
_ plugin.Configurable = (*Factory)(nil)
)

// Factory implements storage.Factory interface as a meta-factory for storage components.
type Factory struct {
FactoryConfig
Expand Down
8 changes: 6 additions & 2 deletions plugin/storage/grpc/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ import (
"github.com/uber/jaeger-lib/metrics"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/plugin/storage/grpc/config"
"github.com/jaegertracing/jaeger/plugin/storage/grpc/shared"
"github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/dependencystore"
"github.com/jaegertracing/jaeger/storage/spanstore"
)

var (
_ io.Closer = (*Factory)(nil)
_ plugin.Configurable = (*Factory)(nil)
)

// Factory implements storage.Factory and creates storage components backed by a storage plugin.
type Factory struct {
options Options
Expand All @@ -44,8 +50,6 @@ type Factory struct {
capabilities shared.PluginCapabilities
}

var _ io.Closer = (*Factory)(nil)

// NewFactory creates a new Factory.
func NewFactory() *Factory {
return &Factory{}
Expand Down
6 changes: 6 additions & 0 deletions plugin/storage/kafka/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ import (
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/pkg/kafka/producer"
"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/storage/dependencystore"
"github.com/jaegertracing/jaeger/storage/spanstore"
)

var (
_ io.Closer = (*Factory)(nil)
_ plugin.Configurable = (*Factory)(nil)
)

// Factory implements storage.Factory and creates write-only storage components backed by kafka.
type Factory struct {
options Options
Expand Down
3 changes: 3 additions & 0 deletions plugin/storage/memory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ import (
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/pkg/distributedlock"
"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/storage/dependencystore"
"github.com/jaegertracing/jaeger/storage/samplingstore"
"github.com/jaegertracing/jaeger/storage/spanstore"
)

var _ plugin.Configurable = (*Factory)(nil)

// Factory implements storage.Factory and creates storage components backed by memory store.
type Factory struct {
options Options
Expand Down