Skip to content

Commit

Permalink
revert zipkin support
Browse files Browse the repository at this point in the history
  • Loading branch information
therealak12 committed Jun 20, 2024
1 parent 1066071 commit 835ebba
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 283 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 @@ -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 @@ 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
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 @@ 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 @@ -1206,12 +1206,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 @@ -4960,7 +4954,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 @@ -5025,12 +5019,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 @@ -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
15 changes: 10 additions & 5 deletions internal/dag/ingress_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package dag

import (
"fmt"
"strconv"
"strings"
"time"
Expand All @@ -28,6 +27,7 @@ import (
contour_v1alpha1 "github.com/projectcontour/contour/apis/projectcontour/v1alpha1"
"github.com/projectcontour/contour/internal/annotation"
"github.com/projectcontour/contour/internal/k8s"
"fmt"
)

// IngressProcessor translates Ingresses into DAG
Expand Down Expand Up @@ -317,10 +317,6 @@ func (p *IngressProcessor) route(ingress *networking_v1.Ingress, host, path stri
r.Name = ingress.Name
}

if p.EnableStatPrefix {
r.StatPrefix = ptr.To(fmt.Sprintf("%s_%s", ingress.Namespace, ingress.Name))
}

switch pathType {
case networking_v1.PathTypePrefix:
prefixMatchType := PrefixMatchSegment
Expand Down Expand Up @@ -349,6 +345,15 @@ func (p *IngressProcessor) route(ingress *networking_v1.Ingress, host, path stri
}
}

// This block should always be after the `switch PathType` block because we rely on the modification made in `path`
if p.EnableStatPrefix {
pathForMetric := "_"
if path != "" {
pathForMetric = strings.TrimPrefix(path, "/")
}
r.StatPrefix = ptr.To(fmt.Sprintf("%s_ingress_%s_path_%s", ingress.Namespace, ingress.Name, pathForMetric))
}

// If we have a wildcard match, add a header match regex rule to match the
// hostname so we can be sure to only match one DNS label. This is required
// as Envoy's virtualhost hostname wildcard matching can match multiple
Expand Down
Loading

0 comments on commit 835ebba

Please sign in to comment.