Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/vector-vrl/web-playground/public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ Some functions of VRL are not supported or don't work as expected at the
moment due to WASM limitations with some Rust crates, in
the future we will modify the functions so that they are supported.

List of functions that aren't supported at the moment:

- `log()`
- `decrypt()`
- `encrypt()`
- `get_hostname()`
- `parse_groks()`
- `random_bytes()`
- `reverse_dns()`
List of functions that aren't supported at the moment. All of them exist,
but they will either error (enrichment functions) or abort (all the others) at runtime.

- `log`
- `get_hostname`
- `parse_grok`
- `parse_groks`
- `reverse_dns`
- `find_enrichment_table_records`
- `get_enrichment_table_record`

Functions from VRL stdlib that are currently not supported can be found
with this [issue filter][vrl-wasm-unsupported-filter]
Expand Down
31 changes: 26 additions & 5 deletions lib/vector-vrl/web-playground/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,29 @@ export class VrlWebPlayground {
program: this.programEditor.getValue(),
event: this.eventEditor.getModel().getLinesContent().join("\n"),
is_jsonl: true,
error: null,
};
}
return {
program: this.programEditor.getValue(),
event: JSON.parse((this.eventEditor.getValue().length == 0) ? "{}" : this.eventEditor.getValue()),
is_jsonl: false,
};

const editorValue = this.eventEditor.getValue();
try {
return {
program: this.programEditor.getValue(),
event: JSON.parse((editorValue.length === 0) ? "{}" : editorValue),
is_jsonl: false,
error: null,
};
}
catch (error) {
console.error(error);
return {
program: this.programEditor.getValue(),
event: null,
is_jsonl: false,
error: `Could not parse JSON event:\n${editorValue}`,
};
}
return state;
}

disableJsonLinting() {
Expand Down Expand Up @@ -168,6 +184,11 @@ export class VrlWebPlayground {
if (input == null) {
input = this.getState();
}
if (input.error) {
this.disableJsonLinting();
this.outputEditor.setValue(input.error);
return input;
}

let res = this.run_vrl(input);
console.log("[DEBUG::handleRunCode()] Printing out res: ", res);
Expand Down
4 changes: 1 addition & 3 deletions lib/vector-vrl/web-playground/public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
],
"module": "vector_vrl_web_playground.js",
"types": "vector_vrl_web_playground.d.ts",
"sideEffects": [
"./snippets/*"
]
"sideEffects": false
}