-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
type: bugA code related bug.A code related bug.vrl: typedefChanges to the progressive type system of VRL.Changes to the progressive type system of VRL.
Description
A note for the community
- Please vote on this issue by adding a π reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Problem
I've had some troubles with log_namespace: true. I found functions being fallible and infallable at the same time, depending on wheter the VRL code runs in a test or 'real'. This can lead to code that does either verify for 'real' or for a test, but not both. Below is a reduced example config.
With object! when running vector test it returns:
warning[E620]: can't abort infallible function
ββ :1:5
β
1 β . = object!(.)
β ^^^^^^- remove this abort (!) instruction
β β
β this function can't fail
.. and the vector starts without problems.
It is just a warning in this example, but e.g. with ., err = object(.) it becomes an error.
With . = object(.) on the other hand vector test does not warn, but vector fails to load the config with:
error[E103]: unhandled fallible assignment
ββ :1:5
β
1 β . = object(.)
β --- ^^^^^^^^^ this expression is fallible because at least one argument's type cannot be verified to be valid
β β
β or change this to an infallible assignment:
β ., err = object(.)
Type checking should not depend on the context, I'd claim.
Configuration
sources:
source_syslog:
type: syslog
address: 0.0.0.0:514
mode: udp
log_namespace: true
transforms:
type_demo:
type: remap
inputs:
- source_syslog
source: |-
. = object!(.)
sinks:
console:
type: console
inputs:
- type_demo
encoding:
codec: json
tests:
- name: test
inputs:
- insert_at: type_demo
type: log
log_fields:
message: Hello
outputs:
- extract_from: type_demo
conditions:
- type: vrl
source: |-
assert!(.message == "Hello")
Version
0.52.0
Debug Output
Example Data
No response
Additional Context
No response
References
No response
Metadata
Metadata
Assignees
Labels
type: bugA code related bug.A code related bug.vrl: typedefChanges to the progressive type system of VRL.Changes to the progressive type system of VRL.