Skip to content

Commit

Permalink
revert zipkin support (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
therealak12 committed Dec 10, 2024
1 parent 6b8d181 commit 587e322
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 281 deletions.
18 changes: 2 additions & 16 deletions apis/projectcontour/v1alpha1/contourconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type ContourConfigurationSpec struct {
// +optional
Metrics *MetricsConfig `json:"metrics,omitempty"`

// Tracing defines properties for exporting trace data to the tracing system.
// Tracing defines properties for exporting trace data to the OpenTelemetry.
Tracing *TracingConfig `json:"tracing,omitempty"`

// FeatureFlags defines toggle to enable new contour features.
Expand Down Expand Up @@ -252,14 +252,6 @@ const (
HTTPVersion2 HTTPVersionType = "HTTP/2"
)

// TracingSystem is the tracing system used in Envoy
type TracingSystem string

const (
TracingSystemOpenTelemetry TracingSystem = "opentelemetry"
TracingSystemZipkin TracingSystem = "zipkin"
)

// EnvoyConfig defines how Envoy is to be Configured from Contour.
type EnvoyConfig struct {
// Listener hold various configurable Envoy listener values.
Expand Down Expand Up @@ -808,7 +800,7 @@ type RateLimitServiceConfig struct {
DefaultGlobalRateLimitPolicy *contour_v1.GlobalRateLimitPolicy `json:"defaultGlobalRateLimitPolicy,omitempty"`
}

// TracingConfig defines properties for exporting trace data to the tracing system.
// TracingConfig defines properties for exporting trace data to OpenTelemetry.
type TracingConfig struct {
// IncludePodDetail defines a flag.
// If it is true, contour will add the pod name and namespace to the span of the trace.
Expand Down Expand Up @@ -838,12 +830,6 @@ type TracingConfig struct {

// ExtensionService identifies the extension service defining the otel-collector.
ExtensionService *NamespacedName `json:"extensionService"`

// System specifies the tracing system used in Evnoy.
// Supported systems are "opentelemetry" and "zipkin".
// Defaults to "opentelemetry".
// +optional
System *TracingSystem `json:"system"`
}

// CustomTag defines custom tags with unique tag name
Expand Down
8 changes: 0 additions & 8 deletions apis/projectcontour/v1alpha1/contourconfig_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ func (t *TracingConfig) Validate() error {
customTagNames = append(customTagNames, customTag.TagName)
}

if t.System != nil {
switch *t.System {
case TracingSystemOpenTelemetry, TracingSystemZipkin:
default:
return fmt.Errorf("invalid tracing system %q", *t.System)
}
}

return nil
}

Expand Down
5 changes: 0 additions & 5 deletions apis/projectcontour/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cmd/contour/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ func (s *Server) setupTracingService(tracingConfig *contour_v1alpha1.TracingConf
OverallSampling: overallSampling,
MaxPathTagLength: ptr.Deref(tracingConfig.MaxPathTagLength, 256),
CustomTags: customTags,
System: ptr.Deref(tracingConfig.System, contour_v1alpha1.TracingSystemOpenTelemetry),
}, nil
}

Expand Down
11 changes: 0 additions & 11 deletions cmd/contour/servecontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,6 @@ func (ctx *serveContext) convertToContourConfigurationSpec() contour_v1alpha1.Co
})
}

var tracingSystem *contour_v1alpha1.TracingSystem
if ctx.Config.Tracing.System != nil {
switch *ctx.Config.Tracing.System {
case config.TracingSystemOpenTelemetry:
tracingSystem = ptr.To(contour_v1alpha1.TracingSystemOpenTelemetry)
case config.TracingSystemZipkin:
tracingSystem = ptr.To(contour_v1alpha1.TracingSystemZipkin)
}
}

tracingConfig = &contour_v1alpha1.TracingConfig{
IncludePodDetail: ctx.Config.Tracing.IncludePodDetail,
ServiceName: ctx.Config.Tracing.ServiceName,
Expand All @@ -412,7 +402,6 @@ func (ctx *serveContext) convertToContourConfigurationSpec() contour_v1alpha1.Co
Name: namespacedName.Name,
Namespace: namespacedName.Namespace,
},
System: tracingSystem,
}
}

Expand Down
16 changes: 2 additions & 14 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data to
the tracing system.
the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with unique
Expand Down Expand Up @@ -1210,12 +1210,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down Expand Up @@ -5047,7 +5041,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data
to the tracing system.
to the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with
Expand Down Expand Up @@ -5112,12 +5106,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down
16 changes: 2 additions & 14 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data to
the tracing system.
the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with unique
Expand Down Expand Up @@ -1430,12 +1430,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down Expand Up @@ -5267,7 +5261,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data
to the tracing system.
to the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with
Expand Down Expand Up @@ -5332,12 +5326,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down
16 changes: 2 additions & 14 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data to
the tracing system.
the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with unique
Expand Down Expand Up @@ -1221,12 +1221,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down Expand Up @@ -5058,7 +5052,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data
to the tracing system.
to the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with
Expand Down Expand Up @@ -5123,12 +5117,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down
16 changes: 2 additions & 14 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data to
the tracing system.
the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with unique
Expand Down Expand Up @@ -1246,12 +1246,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down Expand Up @@ -5083,7 +5077,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data
to the tracing system.
to the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with
Expand Down Expand Up @@ -5148,12 +5142,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down
16 changes: 2 additions & 14 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data to
the tracing system.
the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with unique
Expand Down Expand Up @@ -1430,12 +1430,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down Expand Up @@ -5267,7 +5261,7 @@ spec:
type: object
tracing:
description: Tracing defines properties for exporting trace data
to the tracing system.
to the OpenTelemetry.
properties:
customTags:
description: CustomTags defines a list of custom tags with
Expand Down Expand Up @@ -5332,12 +5326,6 @@ spec:
ServiceName defines the name for the service.
contour's default is contour.
type: string
system:
description: |-
System specifies the tracing system used in Evnoy.
Supported systems are "opentelemetry" and "zipkin".
Defaults to "opentelemetry".
type: string
required:
- extensionService
type: object
Expand Down
29 changes: 3 additions & 26 deletions internal/envoy/v3/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
package v3

import (
"strings"

envoy_config_trace_v3 "github.com/envoyproxy/go-control-plane/envoy/config/trace/v3"
envoy_filter_network_http_connection_manager_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
envoy_trace_v3 "github.com/envoyproxy/go-control-plane/envoy/type/tracing/v3"
envoy_type_v3 "github.com/envoyproxy/go-control-plane/envoy/type/v3"
"google.golang.org/protobuf/types/known/wrapperspb"
"k8s.io/apimachinery/pkg/types"

contour_v1alpha1 "github.com/projectcontour/contour/apis/projectcontour/v1alpha1"
"github.com/projectcontour/contour/internal/dag"
"github.com/projectcontour/contour/internal/protobuf"
"github.com/projectcontour/contour/internal/timeout"
Expand All @@ -43,42 +40,23 @@ func TracingConfig(tracing *EnvoyTracingConfig) *envoy_filter_network_http_conne
}
}

connManagerTracing := &envoy_filter_network_http_connection_manager_v3.HttpConnectionManager_Tracing{
return &envoy_filter_network_http_connection_manager_v3.HttpConnectionManager_Tracing{
OverallSampling: &envoy_type_v3.Percent{
Value: tracing.OverallSampling,
},
MaxPathTagLength: wrapperspb.UInt32(tracing.MaxPathTagLength),
CustomTags: customTags,
SpawnUpstreamSpan: wrapperspb.Bool(true),
}

switch tracing.System {
case contour_v1alpha1.TracingSystemOpenTelemetry:
connManagerTracing.Provider = &envoy_config_trace_v3.Tracing_Http{
Provider: &envoy_config_trace_v3.Tracing_Http{
Name: "envoy.tracers.opentelemetry",
ConfigType: &envoy_config_trace_v3.Tracing_Http_TypedConfig{
TypedConfig: protobuf.MustMarshalAny(&envoy_config_trace_v3.OpenTelemetryConfig{
GrpcService: GrpcService(dag.ExtensionClusterName(tracing.ExtensionService), tracing.SNI, tracing.Timeout),
ServiceName: tracing.ServiceName,
}),
},
}
case contour_v1alpha1.TracingSystemZipkin:
connManagerTracing.Provider = &envoy_config_trace_v3.Tracing_Http{
Name: "envoy.tracers.zipkin",
ConfigType: &envoy_config_trace_v3.Tracing_Http_TypedConfig{
TypedConfig: protobuf.MustMarshalAny(&envoy_config_trace_v3.ZipkinConfig{
CollectorCluster: dag.ExtensionClusterName(tracing.ExtensionService),
CollectorHostname: strings.ReplaceAll(dag.ExtensionClusterName(tracing.ExtensionService), "/", "."),
CollectorEndpoint: "/api/v2/spans",
SharedSpanContext: wrapperspb.Bool(false),
CollectorEndpointVersion: envoy_config_trace_v3.ZipkinConfig_HTTP_JSON,
}),
},
}
},
}

return connManagerTracing
}

func customTag(tag *CustomTag) *envoy_trace_v3.CustomTag {
Expand Down Expand Up @@ -126,7 +104,6 @@ type EnvoyTracingConfig struct {
OverallSampling float64
MaxPathTagLength uint32
CustomTags []*CustomTag
System contour_v1alpha1.TracingSystem
}

type CustomTag struct {
Expand Down
Loading

0 comments on commit 587e322

Please sign in to comment.