Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert zipkin support #9

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -245,14 +245,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 @@ -801,7 +793,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 @@ -831,12 +823,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 @@ -830,7 +830,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 @@ -390,16 +390,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 @@ -410,7 +400,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 @@ -1131,7 +1131,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 @@ -1195,12 +1195,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 @@ -4949,7 +4943,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 @@ -5014,12 +5008,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 @@ -1351,7 +1351,7 @@
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 @@ -1415,12 +1415,6 @@
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 @@ -2785,11 +2779,11 @@
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.

Check failure on line 2782 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 2782 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,

Check failure on line 2786 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 2786 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
Expand Down Expand Up @@ -3277,11 +3271,11 @@
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.

Check failure on line 3274 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 3274 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,

Check failure on line 3278 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 3278 in examples/render/contour-deployment.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
Expand Down Expand Up @@ -5169,7 +5163,7 @@
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 @@ -5234,12 +5228,6 @@
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 @@ -1142,7 +1142,7 @@
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 @@ -1206,12 +1206,6 @@
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 @@ -2576,11 +2570,11 @@
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.

Check failure on line 2573 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 2573 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,

Check failure on line 2577 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 2577 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
Expand Down Expand Up @@ -3068,11 +3062,11 @@
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.

Check failure on line 3065 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 3065 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,

Check failure on line 3069 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion

Check failure on line 3069 in examples/render/contour-gateway-provisioner.yaml

View workflow job for this annotation

GitHub Actions / Codespell

NotIn ==> noting, not in, notion
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
Expand Down Expand Up @@ -4960,7 +4954,7 @@
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 @@ -5025,12 +5019,6 @@
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 @@ -1167,7 +1167,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 @@ -1231,12 +1231,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 @@ -4985,7 +4979,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 @@ -5050,12 +5044,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 @@ -1351,7 +1351,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 @@ -1415,12 +1415,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 @@ -5169,7 +5163,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 @@ -5234,12 +5228,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