Skip to content

Commit

Permalink
[sampling] Inherit default per-operation strategies (jaegertracing#6441)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored and Manik2708 committed Jan 2, 2025
1 parent d12c910 commit 1ce15ce
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
7 changes: 6 additions & 1 deletion cmd/jaeger/internal/all-in-one.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
service:
extensions: [jaeger_storage, jaeger_query, remote_sampling, healthcheckv2, expvar]
extensions: [jaeger_storage, jaeger_query, remote_sampling, healthcheckv2, expvar, zpages]
pipelines:
traces:
receivers: [otlp, jaeger, zipkin]
Expand Down Expand Up @@ -49,6 +49,11 @@ extensions:
expvar:
endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:27777"

zpages:
# for some reason the official extension listens on ephemeral port 55679
# so we override it with a normal port
endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:27778"

receivers:
otlp:
protocols:
Expand Down
10 changes: 10 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,15 @@ 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.WithRegisterToVersion("v2.5.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"),
)
)

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 1ce15ce

Please sign in to comment.