Skip to content

Commit 24278b2

Browse files
committed
chore: tenant api changes
Signed-off-by: Bence Csati <[email protected]>
1 parent d2ebdcf commit 24278b2

File tree

5 files changed

+132
-24
lines changed

5 files changed

+132
-24
lines changed

Diff for: api/telemetry/v1alpha1/tenant_types.go

+23-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ type TransformStatement struct {
2828
Context string `json:"context,omitempty"`
2929
Conditions []string `json:"conditions,omitempty"`
3030
Statements []string `json:"statements,omitempty"`
31+
32+
// +kubebuilder:validation:Enum:=ignore;silent;propagate
33+
34+
// ErrorMode determines how the processor reacts to errors that occur while processing
35+
// this group of statements. When provided, it overrides the default Config ErrorMode.
36+
ErrorMode string `json:"errorMode,omitempty"`
3137
}
3238

3339
// Transform represents the Transform processor, which modifies telemetry based on its configuration.
@@ -42,8 +48,11 @@ type Transform struct {
4248

4349
// +kubebuilder:validation:Enum:=ignore;silent;propagate
4450

45-
// ErrorMode specifies how errors are handled while processing a statement
46-
// vaid options are: ignore, silent, propagate; (default: propagate)
51+
// ErrorMode determines how the processor reacts to errors that occur while processing a statement.
52+
// Valid values are `ignore` and `propagate`.
53+
// `ignore` means the processor ignores errors returned by statements and continues on to the next statement. This is the recommended mode.
54+
// `propagate` means the processor returns the error up the pipeline. This will result in the payload being dropped from the collector.
55+
// The default value is `propagate`.
4756
ErrorMode string `json:"errorMode,omitempty"`
4857

4958
TraceStatements []TransformStatement `json:"traceStatements,omitempty"`
@@ -54,13 +63,22 @@ type Transform struct {
5463
// RouteConfig defines the routing configuration for a tenant
5564
// it will be used to generate routing connectors.
5665
type RouteConfig struct {
57-
// Contains the list of pipelines to use when a record does not meet any of specified conditions.
66+
// DefaultPipelines contains the list of pipelines to use when a more specific record can't be
67+
// found in the routing table.
68+
// Optional.
5869
DefaultPipelines []string `json:"defaultPipelines,omitempty"` // TODO: Provide users with a guide to determine generated pipeline names
5970

6071
// +kubebuilder:validation:Enum:=ignore;silent;propagate
6172

62-
// ErrorMode specifies how errors are handled while processing a statement
63-
// vaid options are: ignore, silent, propagate; (default: propagate)
73+
// ErrorMode determines how the processor reacts to errors that occur while processing an OTTL
74+
// condition.
75+
// Valid values are `ignore` and `propagate`.
76+
// `ignore` means the processor ignores errors returned by conditions and continues on to the
77+
// next condition. This is the recommended mode. If `ignore` is used and a statement's
78+
// condition has an error then the payload will be routed to the default exporter. `propagate`
79+
// means the processor returns the error up the pipeline. This will result in the payload being
80+
// dropped from the collector.
81+
// The default value is `propagate`.
6482
ErrorMode string `json:"errorMode,omitempty"`
6583
}
6684

Diff for: api/telemetry/v1alpha1/zz_generated.deepcopy.go

+14-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: charts/telemetry-controller/crds/telemetry.kube-logging.dev_tenants.yaml

+45-6
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,24 @@ spec:
132132
it will be used to generate routing connectors.
133133
properties:
134134
defaultPipelines:
135-
description: Contains the list of pipelines to use when a record
136-
does not meet any of specified conditions.
135+
description: |-
136+
DefaultPipelines contains the list of pipelines to use when a more specific record can't be
137+
found in the routing table.
138+
Optional.
137139
items:
138140
type: string
139141
type: array
140142
errorMode:
141143
description: |-
142-
ErrorMode specifies how errors are handled while processing a statement
143-
vaid options are: ignore, silent, propagate; (default: propagate)
144+
ErrorMode determines how the processor reacts to errors that occur while processing an OTTL
145+
condition.
146+
Valid values are `ignore` and `propagate`.
147+
`ignore` means the processor ignores errors returned by conditions and continues on to the
148+
next condition. This is the recommended mode. If `ignore` is used and a statement's
149+
condition has an error then the payload will be routed to the default exporter. `propagate`
150+
means the processor returns the error up the pipeline. This will result in the payload being
151+
dropped from the collector.
152+
The default value is `propagate`.
144153
enum:
145154
- ignore
146155
- silent
@@ -211,8 +220,11 @@ spec:
211220
properties:
212221
errorMode:
213222
description: |-
214-
ErrorMode specifies how errors are handled while processing a statement
215-
vaid options are: ignore, silent, propagate; (default: propagate)
223+
ErrorMode determines how the processor reacts to errors that occur while processing a statement.
224+
Valid values are `ignore` and `propagate`.
225+
`ignore` means the processor ignores errors returned by statements and continues on to the next statement. This is the recommended mode.
226+
`propagate` means the processor returns the error up the pipeline. This will result in the payload being dropped from the collector.
227+
The default value is `propagate`.
216228
enum:
217229
- ignore
218230
- silent
@@ -244,6 +256,15 @@ spec:
244256
- datapoint
245257
- log
246258
type: string
259+
errorMode:
260+
description: |-
261+
ErrorMode determines how the processor reacts to errors that occur while processing
262+
this group of statements. When provided, it overrides the default Config ErrorMode.
263+
enum:
264+
- ignore
265+
- silent
266+
- propagate
267+
type: string
247268
statements:
248269
items:
249270
type: string
@@ -270,6 +291,15 @@ spec:
270291
- datapoint
271292
- log
272293
type: string
294+
errorMode:
295+
description: |-
296+
ErrorMode determines how the processor reacts to errors that occur while processing
297+
this group of statements. When provided, it overrides the default Config ErrorMode.
298+
enum:
299+
- ignore
300+
- silent
301+
- propagate
302+
type: string
273303
statements:
274304
items:
275305
type: string
@@ -299,6 +329,15 @@ spec:
299329
- datapoint
300330
- log
301331
type: string
332+
errorMode:
333+
description: |-
334+
ErrorMode determines how the processor reacts to errors that occur while processing
335+
this group of statements. When provided, it overrides the default Config ErrorMode.
336+
enum:
337+
- ignore
338+
- silent
339+
- propagate
340+
type: string
302341
statements:
303342
items:
304343
type: string

Diff for: config/crd/bases/telemetry.kube-logging.dev_tenants.yaml

+45-6
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,24 @@ spec:
132132
it will be used to generate routing connectors.
133133
properties:
134134
defaultPipelines:
135-
description: Contains the list of pipelines to use when a record
136-
does not meet any of specified conditions.
135+
description: |-
136+
DefaultPipelines contains the list of pipelines to use when a more specific record can't be
137+
found in the routing table.
138+
Optional.
137139
items:
138140
type: string
139141
type: array
140142
errorMode:
141143
description: |-
142-
ErrorMode specifies how errors are handled while processing a statement
143-
vaid options are: ignore, silent, propagate; (default: propagate)
144+
ErrorMode determines how the processor reacts to errors that occur while processing an OTTL
145+
condition.
146+
Valid values are `ignore` and `propagate`.
147+
`ignore` means the processor ignores errors returned by conditions and continues on to the
148+
next condition. This is the recommended mode. If `ignore` is used and a statement's
149+
condition has an error then the payload will be routed to the default exporter. `propagate`
150+
means the processor returns the error up the pipeline. This will result in the payload being
151+
dropped from the collector.
152+
The default value is `propagate`.
144153
enum:
145154
- ignore
146155
- silent
@@ -211,8 +220,11 @@ spec:
211220
properties:
212221
errorMode:
213222
description: |-
214-
ErrorMode specifies how errors are handled while processing a statement
215-
vaid options are: ignore, silent, propagate; (default: propagate)
223+
ErrorMode determines how the processor reacts to errors that occur while processing a statement.
224+
Valid values are `ignore` and `propagate`.
225+
`ignore` means the processor ignores errors returned by statements and continues on to the next statement. This is the recommended mode.
226+
`propagate` means the processor returns the error up the pipeline. This will result in the payload being dropped from the collector.
227+
The default value is `propagate`.
216228
enum:
217229
- ignore
218230
- silent
@@ -244,6 +256,15 @@ spec:
244256
- datapoint
245257
- log
246258
type: string
259+
errorMode:
260+
description: |-
261+
ErrorMode determines how the processor reacts to errors that occur while processing
262+
this group of statements. When provided, it overrides the default Config ErrorMode.
263+
enum:
264+
- ignore
265+
- silent
266+
- propagate
267+
type: string
247268
statements:
248269
items:
249270
type: string
@@ -270,6 +291,15 @@ spec:
270291
- datapoint
271292
- log
272293
type: string
294+
errorMode:
295+
description: |-
296+
ErrorMode determines how the processor reacts to errors that occur while processing
297+
this group of statements. When provided, it overrides the default Config ErrorMode.
298+
enum:
299+
- ignore
300+
- silent
301+
- propagate
302+
type: string
273303
statements:
274304
items:
275305
type: string
@@ -299,6 +329,15 @@ spec:
299329
- datapoint
300330
- log
301331
type: string
332+
errorMode:
333+
description: |-
334+
ErrorMode determines how the processor reacts to errors that occur while processing
335+
this group of statements. When provided, it overrides the default Config ErrorMode.
336+
enum:
337+
- ignore
338+
- silent
339+
- propagate
340+
type: string
302341
statements:
303342
items:
304343
type: string

Diff for: pkg/resources/otel_conf_gen/pipeline/components/processor/transform_processor.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ import (
2424
)
2525

2626
type TransformProcessorStatement struct {
27-
Context string `json:"context"`
28-
Conditions []string `json:"conditions"`
29-
Statements []string `json:"statements"`
27+
Context string `json:"context"`
28+
Conditions []string `json:"conditions"`
29+
Statements []string `json:"statements"`
30+
ErrorMde components.ErrorMode `json:"error_mode,omitempty"`
3031
}
3132

3233
type TransformProcessor struct {
@@ -62,6 +63,7 @@ func convertAPIStatements(APIStatements []v1alpha1.TransformStatement) []Transfo
6263
Context: statement.Context,
6364
Conditions: statement.Conditions,
6465
Statements: statement.Statements,
66+
ErrorMde: components.ErrorMode(statement.ErrorMode),
6567
}
6668
}
6769

0 commit comments

Comments
 (0)