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

Expose tunning options via expvar #2496

Merged
merged 12 commits into from
Oct 5, 2020
7 changes: 5 additions & 2 deletions cmd/agent/app/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/uber/jaeger-lib/metrics"
"github.com/uber/jaeger-lib/metrics/fork"
"go.uber.org/zap"

jmetrics "github.com/jaegertracing/jaeger/pkg/metrics"
Expand Down Expand Up @@ -100,7 +101,8 @@ func withRunningAgent(t *testing.T, testcase func(string, chan error)) {
}
logger, logBuf := testutils.NewLogger()
mBldr := &jmetrics.Builder{HTTPRoute: "/metrics", Backend: "prometheus"}
mFactory, err := mBldr.CreateMetricsFactory("jaeger")
metricsFactory, err := mBldr.CreateMetricsFactory("jaeger")
mFactory := fork.New("internal", metrics.NullFactory, metricsFactory)
require.NoError(t, err)
agent, err := cfg.CreateAgent(fakeCollectorProxy{}, logger, mFactory)
require.NoError(t, err)
Expand Down Expand Up @@ -162,7 +164,8 @@ func TestStartStopRace(t *testing.T) {
}
logger, logBuf := testutils.NewLogger()
mBldr := &jmetrics.Builder{HTTPRoute: "/metrics", Backend: "prometheus"}
mFactory, err := mBldr.CreateMetricsFactory("jaeger")
metricsFactory, err := mBldr.CreateMetricsFactory("jaeger")
mFactory := fork.New("internal", metrics.NullFactory, metricsFactory)
require.NoError(t, err)
agent, err := cfg.CreateAgent(fakeCollectorProxy{}, logger, mFactory)
require.NoError(t, err)
Expand Down
15 changes: 15 additions & 0 deletions cmd/agent/app/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (b *Builder) CreateAgent(primaryProxy CollectorProxy, logger *zap.Logger, m
return nil, fmt.Errorf("cannot create processors: %w", err)
}
server := b.HTTPServer.getHTTPServer(primaryProxy.GetManager(), mFactory)
b.publishOpts(mFactory)

return NewAgent(processors, server, logger), nil
}

Expand All @@ -127,6 +129,19 @@ func (b *Builder) getReporter(primaryProxy CollectorProxy) reporter.Reporter {
return reporter.NewMultiReporter(rep...)
}

func (b *Builder) publishOpts(mFactory metrics.Factory) {
internalFactory := mFactory.Namespace(metrics.NSOptions{Name: "internal"})
for _, p := range b.Processors {
prefix := fmt.Sprintf(processorPrefixFmt, p.Model, p.Protocol)
internalFactory.Gauge(metrics.Options{Name: prefix + suffixServerMaxPacketSize}).
Update(int64(p.Server.MaxPacketSize))
internalFactory.Gauge(metrics.Options{Name: prefix + suffixServerQueueSize}).
Update(int64(p.Server.QueueSize))
internalFactory.Gauge(metrics.Options{Name: prefix + suffixWorkers}).
Update(int64(p.Workers))
}
}

func (b *Builder) getProcessors(rep reporter.Reporter, mFactory metrics.Factory, logger *zap.Logger) ([]processors.Processor, error) {
retMe := make([]processors.Processor, len(b.Processors))
for idx, cfg := range b.Processors {
Expand Down
40 changes: 40 additions & 0 deletions cmd/agent/app/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/uber/jaeger-lib/metrics"
"github.com/uber/jaeger-lib/metrics/fork"
"github.com/uber/jaeger-lib/metrics/metricstest"
"go.uber.org/zap"
yaml "gopkg.in/yaml.v2"
Expand Down Expand Up @@ -277,3 +278,42 @@ func TestCreateCollectorProxy_UnknownReporter(t *testing.T) {
assert.Nil(t, proxy)
assert.EqualError(t, err, "unknown reporter type ")
}

func TestPublishOpts(t *testing.T) {
v := viper.New()
cfg := &Builder{}
command := cobra.Command{}
flags := &flag.FlagSet{}
AddFlags(flags)
command.PersistentFlags().AddGoFlagSet(flags)
v.BindPFlags(command.PersistentFlags())
err := command.ParseFlags([]string{
"--http-server.host-port=:8080",
"--processor.jaeger-binary.server-host-port=:1111",
"--processor.jaeger-binary.server-max-packet-size=4242",
"--processor.jaeger-binary.server-queue-size=24",
"--processor.jaeger-binary.workers=42",
})
require.NoError(t, err)
cfg.InitFromViper(v)

baseMetrics := metricstest.NewFactory(time.Second)
forkFactory := metricstest.NewFactory(time.Second)
metricsFactory := fork.New("internal", forkFactory, baseMetrics)
agent, err := cfg.CreateAgent(fakeCollectorProxy{}, zap.NewNop(), metricsFactory)
assert.NoError(t, err)
assert.NotNil(t, agent)

forkFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
Name: "internal.processor.jaeger-binary.server-max-packet-size",
Value: 4242,
})
forkFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
Name: "internal.processor.jaeger-binary.server-queue-size",
Value: 24,
})
forkFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
Name: "internal.processor.jaeger-binary.workers",
Value: 42,
})
}
7 changes: 5 additions & 2 deletions cmd/agent/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const (
suffixServerMaxPacketSize = "server-max-packet-size"
suffixServerSocketBufferSize = "server-socket-buffer-size"
suffixServerHostPort = "server-host-port"

processorPrefixFmt = "processor.%s-%s."

// HTTPServerHostPort is the flag for HTTP endpoint
HTTPServerHostPort = "http-server.host-port"
)
Expand All @@ -48,7 +51,7 @@ var defaultProcessors = []struct {
// AddFlags adds flags for Builder.
func AddFlags(flags *flag.FlagSet) {
for _, p := range defaultProcessors {
prefix := fmt.Sprintf("processor.%s-%s.", p.model, p.protocol)
prefix := fmt.Sprintf(processorPrefixFmt, p.model, p.protocol)
flags.Int(prefix+suffixWorkers, defaultServerWorkers, "how many workers the processor should run")
flags.Int(prefix+suffixServerQueueSize, defaultQueueSize, "length of the queue for the UDP server")
flags.Int(prefix+suffixServerMaxPacketSize, defaultMaxPacketSize, "max packet size for the UDP server")
Expand All @@ -69,7 +72,7 @@ func AddOTELFlags(flags *flag.FlagSet) {
// InitFromViper initializes Builder with properties retrieved from Viper.
func (b *Builder) InitFromViper(v *viper.Viper) *Builder {
for _, processor := range defaultProcessors {
prefix := fmt.Sprintf("processor.%s-%s.", processor.model, processor.protocol)
prefix := fmt.Sprintf(processorPrefixFmt, processor.model, processor.protocol)
p := &ProcessorConfiguration{Model: processor.model, Protocol: processor.protocol}
p.Workers = v.GetInt(prefix + suffixWorkers)
p.Server.QueueSize = v.GetInt(prefix + suffixServerQueueSize)
Expand Down
8 changes: 7 additions & 1 deletion cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/uber/jaeger-lib/metrics"
jexpvar "github.com/uber/jaeger-lib/metrics/expvar"
"github.com/uber/jaeger-lib/metrics/fork"
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"

Expand Down Expand Up @@ -49,9 +51,12 @@ func main() {
return err
}
logger := svc.Logger // shortcut
mFactory := svc.MetricsFactory.
baseFactory := svc.MetricsFactory.
Namespace(metrics.NSOptions{Name: "jaeger"}).
Namespace(metrics.NSOptions{Name: "agent"})
mFactory := fork.New("internal",
jexpvar.NewFactory(10), // backend for internal opts
baseFactory)

rOpts := new(reporter.Options).InitFromViper(v, logger)
grpcBuilder := grpc.NewConnBuilder().InitFromViper(v)
Expand Down Expand Up @@ -79,6 +84,7 @@ func main() {
if err := agent.Run(); err != nil {
return fmt.Errorf("failed to run the agent: %w", err)
}

svc.RunAndThen(func() {
agent.Stop()
cp.Close()
Expand Down
7 changes: 6 additions & 1 deletion cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
jaegerClientConfig "github.com/uber/jaeger-client-go/config"
jaegerClientZapLog "github.com/uber/jaeger-client-go/log/zap"
"github.com/uber/jaeger-lib/metrics"
jexpvar "github.com/uber/jaeger-lib/metrics/expvar"
"github.com/uber/jaeger-lib/metrics/fork"
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"

Expand Down Expand Up @@ -81,7 +83,10 @@ by default uses only in-memory database.`,
}
logger := svc.Logger // shortcut
rootMetricsFactory := svc.MetricsFactory // shortcut
metricsFactory := rootMetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
metricsFactory := fork.New("internal",
jexpvar.NewFactory(10), // backend for internal opts
rootMetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"}))

tracerCloser := initTracer(rootMetricsFactory, svc.Logger)

storageFactory.InitFromViper(v)
Expand Down
1 change: 1 addition & 0 deletions cmd/collector/app/builder_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,6 @@ func (cOpts *CollectorOptions) InitFromViper(v *viper.Viper) *CollectorOptions {
cOpts.CollectorZipkinAllowedOrigins = v.GetString(collectorZipkinAllowedOrigins)
cOpts.CollectorZipkinAllowedHeaders = v.GetString(collectorZipkinAllowedHeaders)
cOpts.TLS = tlsFlagsConfig.InitFromViper(v)

return cOpts
}
7 changes: 7 additions & 0 deletions cmd/collector/app/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,17 @@ func (c *Collector) Start(builderOpts *CollectorOptions) error {
} else {
c.zkServer = zkServer
}
c.publishOpts(builderOpts)

return nil
}

func (c *Collector) publishOpts(cOpts *CollectorOptions) {
internalFactory := c.metricsFactory.Namespace(metrics.NSOptions{Name: "internal"})
internalFactory.Gauge(metrics.Options{Name: collectorNumWorkers}).Update(int64(cOpts.NumWorkers))
internalFactory.Gauge(metrics.Options{Name: collectorQueueSize}).Update(int64(cOpts.QueueSize))
}

// Close the component and all its underlying dependencies
func (c *Collector) Close() error {
// gRPC server
Expand Down
37 changes: 37 additions & 0 deletions cmd/collector/app/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/stretchr/testify/assert"
"github.com/uber/jaeger-lib/metrics/fork"
"github.com/uber/jaeger-lib/metrics/metricstest"
"go.uber.org/zap"

Expand Down Expand Up @@ -61,3 +62,39 @@ type mockStrategyStore struct {
func (m *mockStrategyStore) GetSamplingStrategy(_ context.Context, serviceName string) (*sampling.SamplingStrategyResponse, error) {
return &sampling.SamplingStrategyResponse{}, nil
}

func TestCollector_PublishOpts(t *testing.T) {
// prepare
hc := healthcheck.New()
logger := zap.NewNop()
baseMetrics := metricstest.NewFactory(time.Second)
forkFactory := metricstest.NewFactory(time.Second)
metricsFactory := fork.New("internal", forkFactory, baseMetrics)
spanWriter := &fakeSpanWriter{}
strategyStore := &mockStrategyStore{}

c := New(&CollectorParams{
ServiceName: "collector",
Logger: logger,
MetricsFactory: metricsFactory,
SpanWriter: spanWriter,
StrategyStore: strategyStore,
HealthCheck: hc,
})
collectorOpts := &CollectorOptions{
NumWorkers: 24,
QueueSize: 42,
}

c.Start(collectorOpts)
defer c.Close()

forkFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
Name: "internal.collector.num-workers",
Value: 24,
})
forkFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
Name: "internal.collector.queue-size",
Value: 42,
})
}
6 changes: 5 additions & 1 deletion cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/uber/jaeger-lib/metrics"
jexpvar "github.com/uber/jaeger-lib/metrics/expvar"
"github.com/uber/jaeger-lib/metrics/fork"
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"

Expand Down Expand Up @@ -63,7 +65,9 @@ func main() {
}
logger := svc.Logger // shortcut
baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
metricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "collector"})
metricsFactory := fork.New("internal",
jexpvar.NewFactory(10), // backend for internal opts
baseFactory.Namespace(metrics.NSOptions{Name: "collector"}))

storageFactory.InitFromViper(v)
if err := storageFactory.Initialize(baseFactory, logger); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions cmd/flags/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package flags

import (
"expvar"
"flag"
"fmt"
"os"
Expand Down Expand Up @@ -116,6 +117,13 @@ func (s *Service) Start(v *viper.Viper) error {
s.Logger.Info("Mounting metrics handler on admin server", zap.String("route", route))
s.Admin.Handle(route, h)
}

// Mount expvar routes on different backends
if metricsBuilder.Backend != "expvar" {
s.Logger.Info("Mounting expvar handler on admin server", zap.String("route", "/debug/vars"))
s.Admin.Handle("/debug/vars", expvar.Handler())
}

if err := s.Admin.Serve(); err != nil {
return fmt.Errorf("cannot start the admin server: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/opentelemetry/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible
github.com/uber/jaeger-lib v2.3.1-0.20200925164221-2cac3b34a519+incompatible
dstdfx marked this conversation as resolved.
Show resolved Hide resolved
go.opencensus.io v0.22.4
go.opentelemetry.io/collector v0.10.1-0.20200917170114-639b9a80ed46
go.uber.org/zap v1.16.0
Expand Down
3 changes: 3 additions & 0 deletions cmd/opentelemetry/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/uf
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5 h1:XTrzB+F8+SpRmbhAH8HLxhiiG6nYNwaBZjrFps1oWEk=
github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qEclQKK70g0KxO61gFFZD4=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
Expand Down Expand Up @@ -1109,6 +1110,8 @@ github.com/uber/jaeger-client-go v2.25.0+incompatible h1:IxcNZ7WRY1Y3G4poYlx24sz
github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/uber/jaeger-lib v2.3.1-0.20200925164221-2cac3b34a519+incompatible h1:pif0W8e7IYk2xPZ/KYV8kqDP9aKsUJ/isUON9dDXkVE=
github.com/uber/jaeger-lib v2.3.1-0.20200925164221-2cac3b34a519+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA=
github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.14
require (
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
github.com/DataDog/zstd v1.4.4 // indirect
github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect
github.com/Shopify/sarama v1.22.2-0.20190604114437-cd910a683f9f
github.com/apache/thrift v0.13.0
github.com/bsm/sarama-cluster v2.1.13+incompatible
Expand Down Expand Up @@ -66,7 +67,7 @@ require (
github.com/spf13/viper v1.6.2
github.com/stretchr/testify v1.5.1
github.com/uber/jaeger-client-go v2.23.1+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible
github.com/uber/jaeger-lib v2.4.0+incompatible
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
go.mongodb.org/mongo-driver v1.3.2 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.4 h1:+IawcoXhCBylN7ccwdwf8LOH2jKq7NavGpEPanrlTzE=
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/HdrHistogram/hdrhistogram-go v0.9.0 h1:dpujRju0R4M/QZzcnR1LH1qm+TVG3UzkWdp5tH1WMcg=
github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qEclQKK70g0KxO61gFFZD4=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
Expand Down Expand Up @@ -560,8 +562,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/uber/jaeger-client-go v2.23.1+incompatible h1:uArBYHQR0HqLFFAypI7RsWTzPSj/bDpmZZuQjMLSg1A=
github.com/uber/jaeger-client-go v2.23.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/uber/jaeger-lib v2.4.0+incompatible h1:fY7QsGQWiCt8pajv4r7JEvmATdCVaWxXbjwyYwsNaLQ=
github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
Expand Down
11 changes: 11 additions & 0 deletions plugin/storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
badgerStorageType = "badger"
downsamplingRatio = "downsampling.ratio"
downsamplingHashSalt = "downsampling.hashsalt"
spanStorageType = "span-storage-type"

// defaultDownsamplingRatio is the default downsampling ratio.
defaultDownsamplingRatio = 1.0
Expand Down Expand Up @@ -111,6 +112,8 @@ func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger)
return err
}
}
f.publishOpts()

return nil
}

Expand Down Expand Up @@ -249,3 +252,11 @@ func (f *Factory) Close() error {
}
return multierror.Wrap(errs)
}

func (f *Factory) publishOpts() {
internalFactory := f.metricsFactory.Namespace(metrics.NSOptions{Name: "internal"})
internalFactory.Gauge(metrics.Options{Name: downsamplingRatio}).
Update(int64(f.FactoryConfig.DownsamplingRatio))
internalFactory.Gauge(metrics.Options{Name: spanStorageType + "-" + f.SpanReaderType}).
Update(1)
}
Loading