Skip to content

api: Adding Zipkin Tracing support #3630

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

Merged
merged 16 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
21 changes: 18 additions & 3 deletions api/v1alpha1/tracing_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@ type ProxyTracing struct {
// If provider is kubernetes, pod name and namespace are added by default.
CustomTags map[string]CustomTag `json:"customTags,omitempty"`
// Provider defines the tracing provider.
// Only OpenTelemetry is supported currently.
Provider TracingProvider `json:"provider"`
}

type TracingProviderType string

const (
TracingProviderTypeOpenTelemetry TracingProviderType = "OpenTelemetry"
TracingProviderTypeZipkin TracingProviderType = "Zipkin"
)

// TracingProvider defines the tracing provider configuration.
//
// +kubebuilder:validation:XValidation:message="host or backendRefs needs to be set",rule="has(self.host) || self.backendRefs.size() > 0"
type TracingProvider struct {
// Type defines the tracing provider type.
// EG currently only supports OpenTelemetry.
// +kubebuilder:validation:Enum=OpenTelemetry
// +kubebuilder:validation:Enum=OpenTelemetry;Zipkin
// +kubebuilder:default=OpenTelemetry
Type TracingProviderType `json:"type"`
// Host define the provider service hostname.
Expand All @@ -58,6 +57,9 @@ type TracingProvider struct {
// +kubebuilder:validation:XValidation:message="only support Service kind.",rule="self.all(f, f.kind == 'Service')"
// +kubebuilder:validation:XValidation:message="BackendRefs only supports Core group.",rule="self.all(f, f.group == '')"
BackendRefs []BackendRef `json:"backendRefs,omitempty"`
// Zipkin defines the Zipkin tracing provider configuration
// +optional
Zipkin *ZipkinTracingProvider `json:"zipkin,omitempty"`
}

type CustomTagType string
Expand Down Expand Up @@ -114,3 +116,16 @@ type RequestHeaderCustomTag struct {
// +optional
DefaultValue *string `json:"defaultValue,omitempty"`
}

// ZipkinTracingProvider defines the Zipkin tracing provider configuration.
type ZipkinTracingProvider struct {
// TraceID128Bit determines whether a 128bit trace id will be used
// when creating a new trace instance. If set to false, a 64bit trace
// id will be used.
// +optional
TraceID128Bit *bool `json:"traceId128Bit,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is creating a 1:1 mapping with envoy https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/trace/v3/zipkin.proto#extension-envoy-tracers-zipkin but this name is confusing
prefer if this was TraceIDSize/TraceIDLength *TraceIDType which could default to 64

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would EnableTraceID128Bit or Enable128BitTraceID be a better name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I'm a +1 for Enable128BitTraceID wdyt @envoyproxy/gateway-maintainers @basvanbeek

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable128BitTraceID has my preference too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for input. Field name updated

// DisableSharedSpanContext determines whether the default Envoy behaviour of
// client and server spans sharing the same span context should be disabled.
// +optional
DisableSharedSpanContext *bool `json:"disableSharedSpanContext,omitempty"`
}
30 changes: 30 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -10864,9 +10864,7 @@ spec:
If provider is kubernetes, pod name and namespace are added by default.
type: object
provider:
description: |-
Provider defines the tracing provider.
Only OpenTelemetry is supported currently.
description: Provider defines the tracing provider.
properties:
backendRefs:
description: |-
Expand Down Expand Up @@ -10972,12 +10970,27 @@ spec:
type: integer
type:
default: OpenTelemetry
description: |-
Type defines the tracing provider type.
EG currently only supports OpenTelemetry.
description: Type defines the tracing provider type.
enum:
- OpenTelemetry
- Zipkin
type: string
zipkin:
description: Zipkin defines the Zipkin tracing provider
configuration
properties:
disableSharedSpanContext:
description: |-
DisableSharedSpanContext determines whether the default Envoy behaviour of
client and server spans sharing the same span context should be disabled.
type: boolean
traceId128Bit:
description: |-
TraceID128Bit determines whether a 128bit trace id will be used
when creating a new trace instance. If set to false, a 64bit trace
id will be used.
type: boolean
type: object
required:
- type
type: object
Expand Down
21 changes: 19 additions & 2 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2910,7 +2910,7 @@ _Appears in:_
| --- | --- | --- | --- |
| `samplingRate` | _integer_ | false | SamplingRate controls the rate at which traffic will be<br />selected for tracing if no prior sampling decision has been made.<br />Defaults to 100, valid values [0-100]. 100 indicates 100% sampling. |
| `customTags` | _object (keys:string, values:[CustomTag](#customtag))_ | true | CustomTags defines the custom tags to add to each span.<br />If provider is kubernetes, pod name and namespace are added by default. |
| `provider` | _[TracingProvider](#tracingprovider)_ | true | Provider defines the tracing provider.<br />Only OpenTelemetry is supported currently. |
| `provider` | _[TracingProvider](#tracingprovider)_ | true | Provider defines the tracing provider. |


#### RateLimit
Expand Down Expand Up @@ -3564,10 +3564,11 @@ _Appears in:_

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | _[TracingProviderType](#tracingprovidertype)_ | true | Type defines the tracing provider type.<br />EG currently only supports OpenTelemetry. |
| `type` | _[TracingProviderType](#tracingprovidertype)_ | true | Type defines the tracing provider type. |
| `host` | _string_ | false | Host define the provider service hostname.<br />Deprecated: Use BackendRefs instead. |
| `port` | _integer_ | false | Port defines the port the provider service is exposed on.<br />Deprecated: Use BackendRefs instead. |
| `backendRefs` | _[BackendRef](#backendref) array_ | false | BackendRefs references a Kubernetes object that represents the<br />backend server to which the trace will be sent.<br />Only Service kind is supported for now. |
| `zipkin` | _[ZipkinTracingProvider](#zipkintracingprovider)_ | false | Zipkin defines the Zipkin tracing provider configuration |


#### TracingProviderType
Expand All @@ -3583,6 +3584,7 @@ _Appears in:_
| ----- | ----------- |
| `OpenTelemetry` | |
| `OpenTelemetry` | |
| `Zipkin` | |


#### TriggerEnum
Expand Down Expand Up @@ -3795,3 +3797,18 @@ _Appears in:_
| `numTrustedHops` | _integer_ | false | NumTrustedHops controls the number of additional ingress proxy hops from the right side of XFF HTTP<br />headers to trust when determining the origin client's IP address.<br />Refer to https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#x-forwarded-for<br />for more details. |


#### ZipkinTracingProvider



ZipkinTracingProvider defines the Zipkin tracing provider configuration.

_Appears in:_
- [TracingProvider](#tracingprovider)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `traceId128Bit` | _boolean_ | false | TraceID128Bit determines whether a 128bit trace id will be used<br />when creating a new trace instance. If set to false, a 64bit trace<br />id will be used. |
| `disableSharedSpanContext` | _boolean_ | false | DisableSharedSpanContext determines whether the default Envoy behaviour of<br />client and server spans sharing the same span context should be disabled. |


21 changes: 19 additions & 2 deletions site/content/zh/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2910,7 +2910,7 @@ _Appears in:_
| --- | --- | --- | --- |
| `samplingRate` | _integer_ | false | SamplingRate controls the rate at which traffic will be<br />selected for tracing if no prior sampling decision has been made.<br />Defaults to 100, valid values [0-100]. 100 indicates 100% sampling. |
| `customTags` | _object (keys:string, values:[CustomTag](#customtag))_ | true | CustomTags defines the custom tags to add to each span.<br />If provider is kubernetes, pod name and namespace are added by default. |
| `provider` | _[TracingProvider](#tracingprovider)_ | true | Provider defines the tracing provider.<br />Only OpenTelemetry is supported currently. |
| `provider` | _[TracingProvider](#tracingprovider)_ | true | Provider defines the tracing provider. |


#### RateLimit
Expand Down Expand Up @@ -3564,10 +3564,11 @@ _Appears in:_

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | _[TracingProviderType](#tracingprovidertype)_ | true | Type defines the tracing provider type.<br />EG currently only supports OpenTelemetry. |
| `type` | _[TracingProviderType](#tracingprovidertype)_ | true | Type defines the tracing provider type. |
| `host` | _string_ | false | Host define the provider service hostname.<br />Deprecated: Use BackendRefs instead. |
| `port` | _integer_ | false | Port defines the port the provider service is exposed on.<br />Deprecated: Use BackendRefs instead. |
| `backendRefs` | _[BackendRef](#backendref) array_ | false | BackendRefs references a Kubernetes object that represents the<br />backend server to which the trace will be sent.<br />Only Service kind is supported for now. |
| `zipkin` | _[ZipkinTracingProvider](#zipkintracingprovider)_ | false | Zipkin defines the Zipkin tracing provider configuration |


#### TracingProviderType
Expand All @@ -3583,6 +3584,7 @@ _Appears in:_
| ----- | ----------- |
| `OpenTelemetry` | |
| `OpenTelemetry` | |
| `Zipkin` | |


#### TriggerEnum
Expand Down Expand Up @@ -3795,3 +3797,18 @@ _Appears in:_
| `numTrustedHops` | _integer_ | false | NumTrustedHops controls the number of additional ingress proxy hops from the right side of XFF HTTP<br />headers to trust when determining the origin client's IP address.<br />Refer to https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#x-forwarded-for<br />for more details. |


#### ZipkinTracingProvider



ZipkinTracingProvider defines the Zipkin tracing provider configuration.

_Appears in:_
- [TracingProvider](#tracingprovider)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `traceId128Bit` | _boolean_ | false | TraceID128Bit determines whether a 128bit trace id will be used<br />when creating a new trace instance. If set to false, a 64bit trace<br />id will be used. |
| `disableSharedSpanContext` | _boolean_ | false | DisableSharedSpanContext determines whether the default Envoy behaviour of<br />client and server spans sharing the same span context should be disabled. |