Skip to content

Commit 6092786

Browse files
TeodorSAPNHingerlskhalash
authored
chore: improve OTTL Spec condition message (kyma-project#2681)
Co-authored-by: Nina Hingerl <76950046+NHingerl@users.noreply.github.com> Co-authored-by: Stanislav Khalash <stanislav.khalash@sap.com>
1 parent 8a48844 commit 6092786

File tree

18 files changed

+252
-187
lines changed

18 files changed

+252
-187
lines changed

docs/user/resources/01-telemetry.md

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

docs/user/resources/02-logpipeline.md

Lines changed: 26 additions & 26 deletions
Large diffs are not rendered by default.

docs/user/resources/04-tracepipeline.md

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

docs/user/resources/05-metricpipeline.md

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

docs/user/troubleshooting.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Troubleshoot problems related to the Telemetry module and its pipelines.
44

5+
If you can't find a solution, don't hesitate to create a [GitHub issue](https://github.com/kyma-project/telemetry-manager/issues/new/choose).
6+
57
## No Data Arrive at the Backend
68

79
### Symptom
@@ -146,7 +148,6 @@ There's a configuration or network issue between the metric agent and your appli
146148
telemetry.kyma-project.io/metric-scrape: "true"
147149
policyTypes:
148150
- Ingress
149-
150151
```
151152
152153
## LogPipeline: Log Buffer Filling Up
@@ -185,36 +186,29 @@ This usually happens for one of the following reasons:
185186
2. Test your regex separately. Simplify complex conditions to a single comparison and re-apply.
186187
3. To test your rules, temporarily remove all but one rule to confirm it works as expected. Then, add your other rules incrementally and isolate the rule that is causing the issue.
187188

188-
## Generic EOF Error Message When Using OTTL Transform or Filter
189+
## OTTL Spec Invalid with Unspecific Error Message
189190

190191
### Symptom
191192

192-
- The pipeline configuration fails with vague error messages mentioning "unexpected token `<EOF>`" or EOF (End of File) parsing errors.
193193
- In the pipeline status, you see the condition `ConfigurationGenerated` with status `False` and reason `OTTLSpecInvalid`.
194+
- The pipeline configuration fails with unclear error messages, for example, mentioning "unexpected token `<EOF>`" or EOF (End of File) parsing errors, such as the following example:
195+
196+
```yaml
197+
'Invalid FilterSpec: condition has invalid syntax: 1:64: unexpected token
198+
"<EOF>" (expected <opcomparison> Value)'
199+
```
194200

195201
### Cause
196202

197-
This error occurs when there is a syntax error in the used OTTL functions in your transformation or filter rules. If syntax validation cannot diagnose the error precisely, you get a generic EOF error instead of a specific error message.
203+
If you get a generic EOF error instead of a specific error message, there's usually a syntax error in your OTTL transformation or filter rules. It occurs when the parser cannot diagnose the error precisely.
198204

199-
The following example uses the incorrect function name `isMatch` (it should be `IsMatch`):
205+
The following example uses the incorrect function name `isMatch` (it should be `IsMatch`, because he parser is case-sensitive):
200206
```yaml
201207
# ...
202208
filter:
203209
- conditions:
204210
- 'isMatch(resource.attributes["k8s.namespace.name"], ".*-system")'
205211
```
206-
This mistake produces a generic error message in the `ConfigurationGenerated` status condition of the pipeline, because the parser is case-sensitive and does not recognize the function:
207-
```yaml
208-
status:
209-
conditions:
210-
- lastTransitionTime: "2025-11-11T14:18:19Z"
211-
message: 'Invalid FilterSpec: condition has invalid syntax: 1:64: unexpected token
212-
"<EOF>" (expected <opcomparison> Value)'
213-
observedGeneration: 1
214-
reason: OTTLSpecInvalid
215-
status: "False"
216-
type: ConfigurationGenerated
217-
```
218212

219213
### Solution
220214

internal/conditions/conditions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const (
66
LinkNoDataArriveAtBackend = "https://kyma-project.io/external-content/telemetry-manager/docs/user/troubleshooting.html#no-data-arrive-at-the-backend"
77
LinkNotAllDataArriveAtBackend = "https://kyma-project.io/external-content/telemetry-manager/docs/user/troubleshooting.html#not-all-data-arrive-at-the-backend"
88
LinkGatewayThrottling = "https://kyma-project.io/external-content/telemetry-manager/docs/user/troubleshooting.html#gateway-throttling"
9+
LinkOTTLSpecInvalid = "https://kyma-project.io/external-content/telemetry-manager/docs/user/troubleshooting.html#ottl-spec-invalid-with-unspecific-error-message"
910

1011
LinkFluentBitNoLogsArriveAtBackend = "https://kyma-project.io/#/telemetry-manager/user/02-logs?id=no-logs-arrive-at-the-backend"
1112
LinkFluentBitNotAllLogsArriveAtBackend = "https://kyma-project.io/#/telemetry-manager/user/02-logs?id=not-all-logs-arrive-at-the-backend"
@@ -83,6 +84,7 @@ var commonMessages = map[string]string{
8384
ReasonSelfMonAgentProbingFailed: "Could not determine the health of the telemetry flow because the self monitor probing of agent failed",
8485
ReasonTLSConfigurationInvalid: "TLS configuration invalid: %s",
8586
ReasonValidationFailed: "Pipeline validation failed due to an error from the Kubernetes API server",
87+
ReasonOTTLSpecInvalid: "OTTL specification is invalid, %s. Fix the syntax error indicated by the message or see troubleshooting: " + LinkOTTLSpecInvalid,
8688
}
8789

8890
var commonLogPipelineMessages = map[string]string{

internal/reconciler/logpipeline/otel/reconciler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func TestOTTLSpecValidation(t *testing.T) {
308308
))),
309309
condStatus: metav1.ConditionFalse,
310310
condReason: conditions.ReasonOTTLSpecInvalid,
311-
condMessage: "Invalid TransformSpec: error while parsing statements",
311+
condMessage: "OTTL specification is invalid, invalid TransformSpec: error while parsing statements. Fix the syntax error indicated by the message or see troubleshooting: " + conditions.LinkOTTLSpecInvalid,
312312
},
313313
{
314314
name: "invalid filter spec",
@@ -320,7 +320,7 @@ func TestOTTLSpecValidation(t *testing.T) {
320320
))),
321321
condStatus: metav1.ConditionFalse,
322322
condReason: conditions.ReasonOTTLSpecInvalid,
323-
condMessage: "Invalid FilterSpec: error while parsing conditions",
323+
condMessage: "OTTL specification is invalid, invalid FilterSpec: error while parsing conditions. Fix the syntax error indicated by the message or see troubleshooting: " + conditions.LinkOTTLSpecInvalid,
324324
},
325325
}
326326

internal/reconciler/logpipeline/otel/status.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ func (r *Reconciler) evaluateConfigGeneratedCondition(ctx context.Context, pipel
179179
}
180180

181181
if ottl.IsInvalidOTTLSpecError(err) {
182-
return metav1.ConditionFalse, conditions.ReasonOTTLSpecInvalid, conditions.ConvertErrToMsg(err)
182+
return metav1.ConditionFalse,
183+
conditions.ReasonOTTLSpecInvalid,
184+
fmt.Sprintf(conditions.MessageForOtelLogPipeline(conditions.ReasonOTTLSpecInvalid), err.Error())
183185
}
184186

185187
var APIRequestFailed *errortypes.APIRequestFailedError

internal/reconciler/metricpipeline/reconciler_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,14 +598,14 @@ func TestOTTLSpecValidation(t *testing.T) {
598598
validatorOption: WithTransformSpecValidator(stubs.NewTransformSpecValidator(
599599
&ottl.InvalidOTTLSpecError{Err: fmt.Errorf("invalid TransformSpec: error while parsing statements")},
600600
)),
601-
expectedMessage: "Invalid TransformSpec: error while parsing statements",
601+
expectedMessage: "OTTL specification is invalid, invalid TransformSpec: error while parsing statements. Fix the syntax error indicated by the message or see troubleshooting: " + conditions.LinkOTTLSpecInvalid,
602602
},
603603
{
604604
name: "invalid filter spec",
605605
validatorOption: WithFilterSpecValidator(stubs.NewFilterSpecValidator(
606-
&ottl.InvalidOTTLSpecError{Err: fmt.Errorf("invalid FilterSpec: error while parsing statements")},
606+
&ottl.InvalidOTTLSpecError{Err: fmt.Errorf("invalid FilterSpec: error while parsing conditions")},
607607
)),
608-
expectedMessage: "Invalid FilterSpec: error while parsing statements",
608+
expectedMessage: "OTTL specification is invalid, invalid FilterSpec: error while parsing conditions. Fix the syntax error indicated by the message or see troubleshooting: " + conditions.LinkOTTLSpecInvalid,
609609
},
610610
}
611611

internal/reconciler/metricpipeline/status.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ func (r *Reconciler) evaluateConfigGeneratedCondition(ctx context.Context, pipel
114114
}
115115

116116
if ottl.IsInvalidOTTLSpecError(err) {
117-
return metav1.ConditionFalse, conditions.ReasonOTTLSpecInvalid, conditions.ConvertErrToMsg(err)
117+
return metav1.ConditionFalse,
118+
conditions.ReasonOTTLSpecInvalid,
119+
fmt.Sprintf(conditions.MessageForMetricPipeline(conditions.ReasonOTTLSpecInvalid), err.Error())
118120
}
119121

120122
var APIRequestFailed *errortypes.APIRequestFailedError

0 commit comments

Comments
 (0)