Validating output
Define rules that a test run's output must satisfy.
A test run shows what a pipeline produces. The Validation sub-tab defines rules that the output is checked against, so a run passes or fails automatically instead of being read by hand.
Validation pipelines
Rules are grouped into validation pipelines. A validation pipeline holds the rules for one of the configuration's YAML pipelines: when a test run targets that pipeline, the rules in its group are evaluated against the run's output. Each YAML pipeline can have one validation pipeline.
- Open the Validation sub-tab and select + Pipeline.
- Select the YAML pipeline the group checks. Pipelines that already have a group cannot be selected again.
Each group renders as a card titled with its pipeline's name. A run that targets a pipeline with no group, or an empty group, is evaluated with no rules: success means the collector ran cleanly.
If the group's pipeline is later removed from the YAML, the card shows a warning and its rules stop running, but the group stays editable until you delete it. Deleting a group deletes its rules.
Validation rules
A validation rule checks a run automatically, so a run passes or fails without you reading the output by hand. Each rule evaluates the captured output, or the collector's stderr, of runs that target its group's pipeline.
To add a rule, expand the group's card, select Add Validation Rule, and choose a Rule type.
| Rule type | Checks |
|---|---|
| Match output text | The output or stderr contains, or does not contain, a value, matched as text, regex, or JSON. |
| Record count | The number of records (datapoints, spans, or log records) is equal to, at least, at most, or between given values. |
| Record attribute | An attribute on the records meets a condition, such as being present or equal to a value. |
| Record count diff | The output record count equals the input count, or the input count adjusted by a number. |
| Attribute added on all, Attribute removed on all | An attribute is added to, or removed from, every record between the input and the output. |
| Attribute modified | An attribute's value changes between the input and the output. |
| Cardinality | The number of distinct values a JSONPath resolves to in the output stays within a threshold. |
The record count diff and attribute diff rules compare the input against the output, so they require a test that uses an OTLP input file. The diff rules have a Compare at field that sets the level of the comparison: Record (spans, datapoints, or log records), Resource, or Scope. Compare at Resource to assert enrichment by processors such as k8sattributes or resourcedetection.
A run with a failing rule is marked Validation Failed.
Attribute checks
The Record attribute rule confirms a pipeline produced the attributes you expect. For example, check that k8s.pod.name is present on every record after a k8sattributes processor runs, or that a sensitive attribute is gone after redaction.
A record attribute rule has the following fields.
| Field | Description |
|---|---|
| Match | Which records must satisfy the condition: All records, At least one, or None. |
| Scope | Where the attribute is read: Resource, Scope, or Record. |
| Attribute key | The attribute to check, such as k8s.pod.name. |
| Operator | The condition to apply: Exists, Equals, Contains, Matches regex, or a numeric comparison. |
| Value | The value to compare against. Not used with the Exists operator. |
To check that an attribute is present, set Match to All records and Operator to Exists. To check that an attribute is absent, set Match to None with the Exists operator.
Cardinality checks
The Cardinality rule counts the distinct values a JSONPath resolves to in the output and compares the count to a threshold. Use it as a guardrail against a high-cardinality attribute inflating your metrics ingest.
| Field | Description |
|---|---|
| JSONPath | The path to evaluate, such as $..attributes[?(@.key=='k8s.pod.name')].value.stringValue. Recursive descent, filters, and array wildcards are supported. |
| Operator | At most (default), Less than, Equals, At least, Greater than, or Between. |
| Distinct values | The distinct-value count to compare against. With Between, the field becomes From (distinct count) and a To (distinct count) field is added. |
At most 0 asserts that the attribute never appears in the output.
Output and stderr
A Match output text rule reads from one of two streams, set by Read from:
- Output. The OTLP records the pipeline produced. Use it to assert on what your processors emit.
- Stderr. The collector's own diagnostic log. Use it to catch silent processor drops, OTTL parse errors, and exporter rejections that never reach the output.
Regex library
When a rule matches with a regular expression, Telflo provides a picker and editor to select or write the expression. Common sensitive-data patterns, such as credit card and CVV numbers, are available from a regex library and can be added to a group in one step with Add from regex library.
Use rules with a run
- Define rules in the validation pipeline for the pipeline you test.
- Run a test that targets that pipeline. See Running tests.
- Telflo evaluates the captured output against the group's rules and reports which passed and which failed.
Combine rules with test suites so a saved test is checked the same way every time.
Static validation
Telflo also validates a configuration structurally and against the collector schema as you build. See Validation. Static validation confirms the configuration is valid. Output validation confirms it behaves as expected on sample data.
Last updated on