Skip to content

Commit

Permalink
add zipkin tracing provider config
Browse files Browse the repository at this point in the history
  • Loading branch information
meghaniankov committed Jan 30, 2024
1 parent 985eb91 commit 5577d6f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/envoy/boilerplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
tracing "github.com/envoyproxy/go-control-plane/envoy/config/trace/v3"
eal "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3"
gal "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/grpc/v3"
eauthz "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_authz/v3"
Expand Down Expand Up @@ -205,6 +206,16 @@ func makeFileAccessLog(cfg AccessLogger) *eal.FileAccessLog {
return accessLogConfig
}

func makeZipkinTracingProvider() *tracing.ZipkinConfig {
zipkinTracingProviderConfig := &tracing.ZipkinConfig{
CollectorCluster: "zipkin",
CollectorEndpoint: "/api/v2/spans",
CollectorEndpointVersion: tracing.ZipkinConfig_HTTP_JSON,
}

return zipkinTracingProviderConfig
}

func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.VirtualHost) (*hcm.HttpConnectionManager, error) {
// Access Logs
accessLogConfig := makeFileAccessLog(c.accessLogger)
Expand Down Expand Up @@ -261,6 +272,8 @@ func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.Vir
return &hcm.HttpConnectionManager{}, err
}

zipkinTracingProvider, err := anypb.New(makeZipkinTracingProvider())

return &hcm.HttpConnectionManager{
CodecType: hcm.HttpConnectionManager_AUTO,
StatPrefix: "ingress_http",
Expand All @@ -276,7 +289,12 @@ func (c *KubernetesConfigurator) makeConnectionManager(virtualHosts []*route.Vir
VirtualHosts: virtualHosts,
},
},
Tracing: &hcm.HttpConnectionManager_Tracing{},
Tracing: &hcm.HttpConnectionManager_Tracing{
Provider: &tracing.Tracing_Http{
Name: "config.trace.v3.Tracing.Http",
ConfigType: &tracing.Tracing_Http_TypedConfig{TypedConfig: zipkinTracingProvider},
},
},
AccessLog: accessLoggers,
UseRemoteAddress: &wrapperspb.BoolValue{Value: c.useRemoteAddress},
}, nil
Expand Down

0 comments on commit 5577d6f

Please sign in to comment.