Skip to content

Commit

Permalink
api: Adding Zipkin Tracing support (envoyproxy#3630)
Browse files Browse the repository at this point in the history
* api: Adding Zipkin Tracing support

Signed-off-by: Alex Marston <[email protected]>

* rollback /internal changes

Signed-off-by: Alex Marston <[email protected]>

* nest zipkin configuration under TracingProvider struct

Signed-off-by: Alex Marston <[email protected]>

* rollback internal testdata changes

Signed-off-by: Alex Marston <[email protected]>

* rollback site changes

Signed-off-by: Alex Marston <[email protected]>

* Change ZipkinConfiguration to a pointer.

Co-authored-by: zirain <[email protected]>
Signed-off-by: Alex Marston <[email protected]>

* update deepcopy

Signed-off-by: Alex Marston <[email protected]>

* update description for TraceId128Bit field

Signed-off-by: Alex Marston <[email protected]>

* update site docs

Signed-off-by: Alex Marston <[email protected]>

* rename Zipkin config struct

Signed-off-by: Alex Marston <[email protected]>

* update api

Signed-off-by: Alex Marston <[email protected]>

* pointers for optional fields

Signed-off-by: Alex Marston <[email protected]>

* remove CollectorHostname

Signed-off-by: Alex Marston <[email protected]>

* TraceID128Bit -> Enable128BitTraceID

Signed-off-by: Alex Marston <[email protected]>

---------

Signed-off-by: Alex Marston <[email protected]>
Signed-off-by: Alex Marston <[email protected]>
Co-authored-by: zirain <[email protected]>
  • Loading branch information
alexandermarston and zirain authored Jun 24, 2024
1 parent 9830c4d commit 51196b4
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 13 deletions.
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 {
// Enable128BitTraceID 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
Enable128BitTraceID *bool `json:"enable128BitTraceId,omitempty"`
// 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
enable128BitTraceId:
description: |-
Enable128BitTraceID 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 |
| --- | --- | --- | --- |
| `enable128BitTraceId` | _boolean_ | false | Enable128BitTraceID 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 |
| --- | --- | --- | --- |
| `enable128BitTraceId` | _boolean_ | false | Enable128BitTraceID 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. |


0 comments on commit 51196b4

Please sign in to comment.