Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRL compiler warns about the unused result of set_semantic_meaning #1149

Closed
sfackler opened this issue Nov 26, 2024 · 2 comments · Fixed by vectordotdev/vector#21896 or #1148
Closed
Labels
type: bug A code related bug

Comments

@sfackler
Copy link

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

The VRL compiler reports a warning for calls to set_semantic_meaning:

2024-11-26T02:02:17.453462Z  WARN transform{component_kind="transform" component_id=talos_kernel_logs_cleanup component_type=remap}: vector::transforms::remap: VRL compilation warning. warnings=
warning[E900]: unused result for function call `set_semantic_meaning(."talos-time", "timestamp")`
  ┌─ :1:1
  │
1 │ set_semantic_meaning(."talos-time", "timestamp")
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the result of this expression or remove it
  │
  = this expression has no side-effects
  = see language documentation at https://vrl.dev
  = try your code in the VRL REPL, learn more at https://vrl.dev/examples

From looking at the docs, it seems to be true that the function has no side effects, but that it also returns no value so the warning seems wrong.

Configuration

set_semantic_meaning(."talos-time", "timestamp")

del(.clock)
del(.seq)
del(."talos-level")
."talos-time" = parse_timestamp!(."talos-time", "%+")

Version

0.42.0

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

@sfackler sfackler added the type: bug A code related bug label Nov 26, 2024
@pront pront changed the title VRL compiler warns about the unused result of set_semantic_meaning VRL compiler warns about the unused result of set_semantic_meaning Nov 26, 2024
@pront
Copy link
Member

pront commented Nov 26, 2024

Thanks @sfackler,

Edit:

  • we need to mark this as impure() here
  • add set_semantic_meaning to this list

@pront pront added vrl: stdlib Changes to the standard library and removed vrl: stdlib Changes to the standard library labels Nov 26, 2024
@pront
Copy link
Member

pront commented Nov 27, 2024

Fixing this in VRL now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A code related bug
Projects
None yet
2 participants