Skip to content

Commit

Permalink
fix tracing-provider config
Browse files Browse the repository at this point in the history
  • Loading branch information
meghaniankov committed Jan 31, 2024
1 parent 6d5c95c commit 5a75ea8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ func main(*cobra.Command, []string) error {
envoy.WithSyncSecrets(c.SyncSecrets),
envoy.WithDefaultRetryOn(viper.GetString("retryOn")),
envoy.WithAccessLog(c.AccessLogger),
envoy.WithTracingProvider(viper.GetString("tracingProvider")),
)
snapshotter := envoy.NewSnapshotter(envoyCache, configurator, aggregator)

Expand Down
6 changes: 3 additions & 3 deletions pkg/envoy/boilerplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func makeZipkinTracingProvider() *tracing.ZipkinConfig {
return zipkinTracingProviderConfig
}

func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.VirtualHost, tracingProvider string) (*hcm.HttpConnectionManager, error) {
func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.VirtualHost) (*hcm.HttpConnectionManager, error) {
// Access Logs
accessLogConfig := makeFileAccessLog(c.accessLogger)
anyAccessLogConfig, err := anypb.New(accessLogConfig)
Expand Down Expand Up @@ -274,7 +274,7 @@ func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.Vir

tracingProviderConfig := &hcm.HttpConnectionManager_Tracing{}

if tracingProvider == "zipkin" {
if c.tracingProvider == "zipkin" {
zipkinTracingProvider, err := anypb.New(makeZipkinTracingProvider())
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -310,7 +310,7 @@ func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.Vir
}

func (c *KubernetesConfigurator) makeFilterChain(certificate Certificate, virtualHosts []*route.VirtualHost) (listener.FilterChain, error) {
httpConnectionManager, err := c.makeConnectionManager(virtualHosts, c.tracingProvider)
httpConnectionManager, err := c.makeConnectionManager(virtualHosts)
if err != nil {
return listener.FilterChain{}, fmt.Errorf("failed to get httpConnectionManager: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/envoy/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (c *KubernetesConfigurator) generateHTTPFilterChain(config *envoyConfigurat
virtualHosts = append(virtualHosts, vhost)
}

httpConnectionManager, err := c.makeConnectionManager(virtualHosts, c.tracingProvider)
httpConnectionManager, err := c.makeConnectionManager(virtualHosts)
if err != nil {
return nil, err
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/envoy/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,10 @@ func WithAccessLog(accessLogger AccessLogger) option {
c.accessLogger = accessLogger
}
}

// WithTracingProvider configures the tracing provider for HTTP connection manager
func WithTracingProvider(tracingProvider string) option {
return func(c *KubernetesConfigurator) {
c.tracingProvider = tracingProvider
}
}

0 comments on commit 5a75ea8

Please sign in to comment.