Skip to content

Commit

Permalink
[sampling] Inherit default per-operation strategies
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro committed Dec 30, 2024
1 parent 752e8d2 commit c0a6e47
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
11 changes: 11 additions & 0 deletions cmd/jaeger/internal/extension/remotesampling/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/featuregate"

"github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive"
)
Expand All @@ -26,6 +27,16 @@ var (
_ component.Config = (*Config)(nil)
_ component.ConfigValidator = (*Config)(nil)
_ confmap.Unmarshaler = (*Config)(nil)

includeDefaultOpStrategies = featuregate.GlobalRegistry().MustRegister(
"jaeger.sampling.includeDefaultOpStrategies",
featuregate.StageBeta, // enabed by default
featuregate.WithRegisterFromVersion("v2.2.0"),
featuregate.WithRegisterDescription("Forces service strategy to be merged with default strategy, including per-operation overrides."),
featuregate.WithRegisterReferenceURL("https://github.com/jaegertracing/jaeger/issues/5270"),
// TODO set ToVersion after going to Beta stage
// featuregate.WithRegisterToVersion("v0.70.0"),
)
)

type Config struct {
Expand Down
5 changes: 3 additions & 2 deletions cmd/jaeger/internal/extension/remotesampling/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ func (ext *rsExtension) Shutdown(ctx context.Context) error {

func (ext *rsExtension) startFileBasedStrategyProvider(_ context.Context) error {
opts := static.Options{
StrategiesFile: ext.cfg.File.Path,
ReloadInterval: ext.cfg.File.ReloadInterval,
StrategiesFile: ext.cfg.File.Path,
ReloadInterval: ext.cfg.File.ReloadInterval,
IncludeDefaultOpStrategies: includeDefaultOpStrategies.IsEnabled(),
}

// contextcheck linter complains about next line that context is not passed.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ require (
go.opentelemetry.io/collector/extension v0.116.0
go.opentelemetry.io/collector/extension/extensiontest v0.116.0
go.opentelemetry.io/collector/extension/zpagesextension v0.116.0
go.opentelemetry.io/collector/featuregate v1.22.0
go.opentelemetry.io/collector/otelcol v0.116.0
go.opentelemetry.io/collector/pdata v1.22.0
go.opentelemetry.io/collector/pipeline v0.116.0
Expand Down Expand Up @@ -248,7 +249,6 @@ require (
go.opentelemetry.io/collector/extension/auth v0.116.0 // indirect
go.opentelemetry.io/collector/extension/experimental/storage v0.116.0 // indirect
go.opentelemetry.io/collector/extension/extensioncapabilities v0.116.0
go.opentelemetry.io/collector/featuregate v1.22.0 // indirect
go.opentelemetry.io/collector/internal/fanoutconsumer v0.116.0 // indirect
go.opentelemetry.io/collector/internal/memorylimiter v0.116.0 // indirect
go.opentelemetry.io/collector/internal/sharedcomponent v0.116.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion plugin/sampling/strategyprovider/static/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Options struct {
func AddFlags(flagSet *flag.FlagSet) {
flagSet.Duration(samplingStrategiesReloadInterval, 0, "Reload interval to check and reload sampling strategies file. Zero value means no reloading")
flagSet.String(samplingStrategiesFile, "", "The path for the sampling strategies file in JSON format. See sampling documentation to see format of the file")
flagSet.Bool(samplingStrategiesBugfix5270, false, "Include default operation level strategies for Ratesampling type service level strategy. Cf. https://github.com/jaegertracing/jaeger/issues/5270")
flagSet.Bool(samplingStrategiesBugfix5270, true, "Include default operation level strategies for Ratesampling type service level strategy. Cf. https://github.com/jaegertracing/jaeger/issues/5270")
}

// InitFromViper initializes Options with properties from viper
Expand Down

0 comments on commit c0a6e47

Please sign in to comment.