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

feat(new transform): Initial javascript transform implementation #721

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
89302c9
Add new `javascript` transform
a-rodin Aug 4, 2019
da6874c
Remove debugging service from docker-compose.yml
a-rodin Aug 7, 2019
b94efc0
Clarify details in usage docs
a-rodin Aug 7, 2019
8745a87
Add path option to the metadata
a-rodin Aug 7, 2019
edefa8f
Remove debug logging
a-rodin Aug 8, 2019
3129b2f
Add benchmark for javascript transform
a-rodin Aug 8, 2019
52b792c
Merge branch 'master' into javascript-transform
a-rodin Aug 8, 2019
b7255e4
Use QuickJS with fixed stack overflow checking
a-rodin Aug 9, 2019
f8617d3
Replace eval to call_function in transform function
a-rodin Aug 9, 2019
33ad00c
Use quick-js 0.2.2 and construct JsValues natively
a-rodin Aug 13, 2019
30c11e2
Avoid possible integer overflows
a-rodin Aug 13, 2019
51aa796
Fix anonymous handler injection
a-rodin Aug 13, 2019
81e1c3c
Merge branch 'master' into javascript-transform
a-rodin Aug 13, 2019
bbd7e4d
Get rid of unsafe Send for JavaScript context
a-rodin Aug 21, 2019
38d6f4c
Update image for JavaScript transform
a-rodin Aug 22, 2019
db0d3ab
Merge branch 'master' into javascript-transform
a-rodin Aug 24, 2019
eda0e77
Regenerate docs
a-rodin Aug 24, 2019
0e21bcc
Merge branch 'master' into javascript-transform
a-rodin Aug 27, 2019
0f2a649
Create JavaScriptProcessor directly from JavaScriptConfig
a-rodin Aug 29, 2019
8ba2cb8
Update benches to use updated JavaScript::new
a-rodin Aug 29, 2019
ab5c512
Merge branch 'master' into javascript-transform
a-rodin Aug 30, 2019
cf65fbc
Update auto-generated files
a-rodin Aug 30, 2019
7198f9b
Update quick-js dependency
a-rodin Sep 2, 2019
2b3ff91
Use expect() instead of unwrap() for threading errors
a-rodin Sep 2, 2019
fc77a0c
Use from_utf8_lossy() instead of from_utf8()
a-rodin Sep 2, 2019
0d124dc
Use SourceOrPath enum in JavaScript config
a-rodin Sep 2, 2019
e63bf06
Merge branch 'master' into javascript-transform
a-rodin Oct 1, 2019
4a3e525
Add javascript transform to .meta
a-rodin Oct 1, 2019
65c2e28
Regenerate docs
a-rodin Oct 1, 2019
140f2b0
Use snafu for error handling
a-rodin Oct 2, 2019
b2e5737
Store integers as JavaScript BigInts
a-rodin Oct 3, 2019
67e34fb
Document Vector to JavaScript types correspondence
a-rodin Oct 3, 2019
7831ebf
Fix failing benchmarks
a-rodin Oct 3, 2019
fa0a5cd
Create events for lua/javascript field filter outside of the benched …
a-rodin Oct 3, 2019
bbd47a5
Use tracing to report about JavaScript errors
a-rodin Oct 4, 2019
f92e0b2
Merge branch 'master' into javascript-transform
a-rodin Oct 9, 2019
7d0636a
Update Cargo.lock
a-rodin Oct 9, 2019
fb7345e
Merge branch 'master' into javascript-transform
a-rodin Jan 8, 2020
b16aef8
Sync changes with the current `master` branch
a-rodin Jan 8, 2020
9f2ef13
Update docs
a-rodin Jan 8, 2020
f11f2e1
Disable `javascript` transform on Windows
a-rodin Jan 8, 2020
8759b8c
Fix benches
a-rodin Jan 8, 2020
9014eb4
Use newer machine image for `test-stable-kubernetes`
a-rodin Jan 8, 2020
652fcd9
Downgrade quick-js dependency
a-rodin Jan 8, 2020
a64db71
Revert "Downgrade quick-js dependency"
a-rodin Jan 9, 2020
ac117cd
Run `test-stable` using `builder-x86_64-unknown-linux-musl`
a-rodin Jan 9, 2020
5f7ed3c
Add a `quick-js` feature
a-rodin Jan 9, 2020
b986bf6
Reduce number of build jobs to prevent OOM
a-rodin Jan 9, 2020
174d571
Reduce number of build jobs for `test-stable`
a-rodin Jan 9, 2020
85a7878
Merge branch 'test-stable-musl' into javascript-transform
a-rodin Jan 13, 2020
b44df78
Merge branch 'master' into javascript-transform
a-rodin Jan 13, 2020
1a22b93
Run `make generate`
a-rodin Jan 13, 2020
d8e142a
Merge branch 'master' into javascript-transform
a-rodin Jan 13, 2020
274f0ba
Merge branch 'master' into javascript-transform
a-rodin Mar 30, 2020
f6ada93
Make tests pass after merging
a-rodin Mar 30, 2020
101d6a7
Fix warnings
a-rodin Apr 8, 2020
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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ jobs:
cargo test --release --no-default-features --features default-msvc -- --test-threads 1

test-stable-kubernetes:
machine: true
machine:
image: ubuntu-1604:201903-01
resource_class: xlarge
environment:
K8S_VERSION: v1.10.0
Expand Down
1 change: 1 addition & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ scopes:
- field_filter transform
- geoip transform
- grok_parser transform
- javascript transform
- json_parser transform
- log_to_metric transform
- logfmt_parser transform
Expand Down
1 change: 1 addition & 0 deletions .meta/links.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ docker_object_labels = "https://docs.docker.com/config/labels-custom-metadata/"
dockerfile = "https://github.com/timberio/vector/blob/master/Dockerfile"
dpkg = "https://wiki.debian.org/dpkg"
elasticsearch = "https://www.elastic.co/products/elasticsearch"
es2019_spec = "https://www.ecma-international.org/ecma-262/10.0/index.html"
event_proto = "https://github.com/timberio/vector/blob/master/proto/event.proto"
exit_codes = "https://docs.rs/exitcode/1.1.2/exitcode/#constants"
file_sink_source = "https://github.com/timberio/vector/blob/master/src/sinks/file/"
Expand Down
42 changes: 42 additions & 0 deletions .meta/transforms/javascript.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[transforms.javascript]
title = "JavaScript"
allow_you_to_description = "transform events with a full embedded JavaScript engine"
beta = true
common = true
function_category = "program"
guides = []
input_types = ["log"]
output_types = ["log"]
resources = [
{name = "ES 2019 Specification", short_link = "es2019_spec"}
]

[transforms.javascript.options.source]
type = "string"
examples = [
"""\
event => ({...event, field: 'value'})
"""
]
common = true
null = true
description = "The inline JavaScript source with handler function."

[transforms.javascript.options.path]
type = "string"
examples = ["/etc/vector/transform.js"]
null = true
description = "The path to JavaScript source file with handler function."

[transforms.javascript.options.handler]
type = "string"
examples = ["handler"]
common = true
null = true
description = "Name of the handler function."

[transforms.javascript.options.memory_limit]
type = "int"
examples = [10000000]
null = true
description = "Maximum allowed RAM usage for JavaScript engine in bytes."
71 changes: 67 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ smpl_jwt = { version = "0.4.0", optional = true }

# External libs
derivative = "1.0"
chrono = "0.4.6"
chrono = "0.4.7"
rand = "0.5.5"
regex = "1.3.5"
bytes = { version = "0.4.10", features = ["serde"] }
Expand Down Expand Up @@ -151,6 +151,7 @@ lru = "0.4.3"
k8s-openapi = { version = "0.5.1", features = ["v1_15"], optional = true }
bloom = "0.3.2"
pulsar = { version = "0.3.0", optional = true }
quick-js = { version = "0.3.1", optional = true, features = ["chrono", "bigint"] }

[target.'cfg(unix)'.dependencies]
atty = "0.2"
Expand All @@ -170,6 +171,7 @@ libz-sys = "1.0"
walkdir = "2.2.7"
elastic_responses = "0.20"
matches = "0.1.8"
mktemp = "0.4.0"
pretty_assertions = "0.6.1"
proptest = "0.9"
tokio01-test = "0.1.1"
Expand Down Expand Up @@ -251,6 +253,7 @@ transforms = [
"transforms-field_filter",
"transforms-geoip",
"transforms-grok_parser",
"transforms-javascript",
"transforms-json_parser",
"transforms-kubernetes",
"transforms-log_to_metric",
Expand All @@ -277,6 +280,7 @@ transforms-dedupe = []
transforms-field_filter = []
transforms-geoip = ["maxminddb"]
transforms-grok_parser = ["grok"]
transforms-javascript = ["quick-js"]
transforms-json_parser = []
transforms-kubernetes = ["k8s-openapi"]
transforms-log_to_metric = []
Expand Down
2 changes: 2 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod buffering;
mod event;
mod files;
mod http;
mod javascript;
mod lua;

criterion_group!(
Expand All @@ -38,6 +39,7 @@ criterion_main!(
batch::batch,
files::files,
lua::lua,
javascript::javascript,
event::event
);

Expand Down
Loading