-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(odbc source): Add ODBC source implementation #24044
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
base: master
Are you sure you want to change the base?
Conversation
…ata_path properties tests
# Conflicts: # Cargo.lock # Cargo.toml # scripts/integration/Dockerfile # src/internal_events/mod.rs # src/sources/mod.rs
…ostgreSQL services
…ion for an ODBC source
…for MariaDB usage
|
Hi @pront @aramperes 👋 |
# Conflicts: # scripts/integration/Dockerfile
# Conflicts: # LICENSE-3rdparty.csv
|
Hi @powerumc, please resolve the merge conflicts and look at the failing checks. We will take another look once those are addressed. |
src/sources/odbc/mod.rs
Outdated
| /// Newtype around `cron::Schedule` that enables a `Configurable` implementation. | ||
| #[derive(Clone, Serialize, Deserialize)] | ||
| #[serde(transparent)] | ||
| pub struct OdbcSchedule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: move code to a new module (under /odbc/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve updated the changes by moving the OdbcSchedule implementation to schedule.rs as suggested. a44ab52
src/sources/odbc/client.rs
Outdated
| "Periodically pulls observability data from an ODBC interface by running a scheduled query." | ||
| ))] | ||
| #[derive(Clone, Debug)] | ||
| pub struct OdbcConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to a new config.rs module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Conflicts: # Cargo.lock # src/internal_events/mod.rs
…wline inconsistency
This integration test was working fine before the merge on my mac. Of course, it builds fine locally on my Mac. I’m not sure yet whether the issue is caused by my changes or something else, and I’m continuing to investigate by trying different approaches. Run `cargo vdev integration test odbc-mariadb -v`error: could not compile `vector` (lib test) due to 1 previous error
error: command `/usr/local/rustup/toolchains/1.91-aarch64-unknown-linux-gnu/bin/cargo test --no-run --message-format json-render-diagnostics --lib --features all-integration-tests --no-default-features` exited with code 101You can see more detailed error information by running the command inside the Docker container # /usr/local/rustup/toolchains/1.91-aarch64-unknown-linux-gnu/bin/cargo test --no-run --message-format json-render-diagnostics --lib --features all-integration-tests --no-default-features
...
info: installing component 'rustc'
info: installing component 'rustfmt'
error[E0514]: found crate `lalrpop` compiled by an incompatible version of rustc
--> /usr/local/cargo/git/checkouts/vrl-7b350af036089ddd/1f0d8a5/build.rs:1:1
|
1 | extern crate lalrpop;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: the following crate versions were found:
crate `lalrpop` compiled by rustc 1.91.1 (ed61e7d7e 2025-11-07): /home/vector/target/debug/deps/liblalrpop-e5c02c887748f8d8.rlib
= help: please recompile that crate using this compiler (rustc 1.90.0 (1159e78c4 2025-09-14)) (consider running `cargo clean` first)
error[E0514]: found crate `ua_parser` compiled by an incompatible version of rustc
--> /usr/local/cargo/git/checkouts/vrl-7b350af036089ddd/1f0d8a5/build.rs:11:5
|
11 | use ua_parser::device::Flag;
| ^^^^^^^^^
|
= note: the following crate versions were found:
crate `ua_parser` compiled by rustc 1.91.1 (ed61e7d7e 2025-11-07): /home/vector/target/debug/deps/libua_parser-0068263c251d7689.rlib
= help: please recompile that crate using this compiler (rustc 1.90.0 (1159e78c4 2025-09-14)) (consider running `cargo clean` first)
error[E0514]: found crate `ua_parser` compiled by an incompatible version of rustc
--> /usr/local/cargo/git/checkouts/vrl-7b350af036089ddd/1f0d8a5/build.rs:69:18
|
69 | let regexes: ua_parser::Regexes =
| ^^^^^^^^^
|
= note: the following crate versions were found:
crate `ua_parser` compiled by rustc 1.91.1 (ed61e7d7e 2025-11-07): /home/vector/target/debug/deps/libua_parser-0068263c251d7689.rlib
= help: please recompile that crate using this compiler (rustc 1.90.0 (1159e78c4 2025-09-14)) (consider running `cargo clean` first)
error[E0514]: found crate `serde_yaml` compiled by an incompatible version of rustc
--> /usr/local/cargo/git/checkouts/vrl-7b350af036089ddd/1f0d8a5/build.rs:70:9
|
70 | serde_yaml::from_slice(®exes).expect("Regex file is not valid yaml");
| ^^^^^^^^^^
|
= note: the following crate versions were found:
crate `serde_yaml` compiled by rustc 1.91.1 (ed61e7d7e 2025-11-07): /home/vector/target/debug/deps/libserde_yaml-b0a611a1255d908c.rlib
= help: please recompile that crate using this compiler (rustc 1.90.0 (1159e78c4 2025-09-14)) (consider running `cargo clean` first)
For more information about this error, try `rustc --explain E0514`.
error: could not compile `vrl` (build script) due to 4 previous errors
error[E0514]: found crate `unicode_segmentation` compiled by an incompatible version of rustc
--> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/convert_case-0.7.1/src/boundary.rs:1:5
|
1 | use unicode_segmentation::UnicodeSegmentation;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: the following crate versions were found:
crate `unicode_segmentation` compiled by <unknown rustc version>: /home/vector/target/debug/deps/libunicode_segmentation-06119734fac1cf78.rmeta
= help: please recompile that crate using this compiler (rustc 1.83.0 (90b35a623 2024-11-26)) (consider running `cargo clean` first)
error[E0514]: found crate `unicode_segmentation` compiled by an incompatible version of rustc
--> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/convert_case-0.7.1/src/pattern.rs:6:5
|
6 | use unicode_segmentation::UnicodeSegmentation;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: the following crate versions were found:
crate `unicode_segmentation` compiled by <unknown rustc version>: /home/vector/target/debug/deps/libunicode_segmentation-06119734fac1cf78.rmeta
= help: please recompile that crate using this compiler (rustc 1.83.0 (90b35a623 2024-11-26)) (consider running `cargo clean` first)
error[E0599]: no method named `grapheme_indices` found for reference `&str` in the current scope
--> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/convert_case-0.7.1/src/boundary.rs:420:52
|
420 | let (indices, graphemes): (Vec<_>, Vec<_>) = s.grapheme_indices(true).unzip();
| ^^^^^^^^^^^^^^^^
|
help: there is a method `char_indices` with a similar name, but with different arguments
--> /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/str/mod.rs:896:5
error[E0599]: no method named `graphemes` found for reference `&str` in the current scope
--> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/convert_case-0.7.1/src/pattern.rs:23:38
|
23 | let mut chars = word.graphemes(true);
| ^^^^^^^^^ method not found in `&str`
error[E0599]: no method named `graphemes` found for reference `&str` in the current scope
--> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/convert_case-0.7.1/src/pattern.rs:31:38
|
31 | let mut chars = word.graphemes(true);
| ^^^^^^^^^ method not found in `&str`
Some errors have detailed explanations: E0514, E0599.
For more information about an error, try `rustc --explain E0514`.
error: could not compile `convert_case` (lib) due to 5 previous errors
{"reason":"build-script-executed","package_id":"registry+https://github.com/rust-lang/crates.io-index#[email protected]","linked_libs":["static=ssl","static=crypto"],"linked_paths":["native=/home/vector/target/debug/build/openssl-sys-bb6c5d7608652f5d/out/openssl-build/install/lib"],"cfgs":["osslconf=\"OPENSSL_NO_IDEA\"","osslconf=\"OPENSSL_NO_CAMELLIA\"","osslconf=\"OPENSSL_NO_COMP\"","osslconf=\"OPENSSL_NO_SSL3_METHOD\"","osslconf=\"OPENSSL_NO_SEED\"","openssl","ossl340","ossl330","ossl320","ossl300","ossl101","ossl102","ossl102f","ossl102h","ossl110","ossl110f","ossl110g","ossl110h","ossl111","ossl111b","ossl111c","ossl111d"],"env":[],"out_dir":"/home/vector/target/debug/build/openssl-sys-bb6c5d7608652f5d/out"}
{"reason":"build-finished","success":false} |
The issue was caused by the missing unixodbc-dev package. (b599b75) |
# Conflicts: # Cargo.lock
Summary
This PR implemented a new ODBC(Open Database Connectivity) Source.
Vector configuration
Manual configuration example
Create example sql file
Configure ODBC and MariaDB Driver on MacOS
Run MariaDB docker container
docker run \ --rm \ --name mariadb \ -e MYSQL_ROOT_PASSWORD=vector \ -e MYSQL_USER=vector \ -e MYSQL_PASSWORD=vector \ -e MYSQL_DATABASE=vector_db \ -v $(pwd)/example.sql:/docker-entrypoint-initdb.d/example.sql:ro \ -p 3306:3306 \ mariadb:latestHow did you test this PR?
I tested it with integration tests of two databases: MariaDB and Postgresql.
(Testing the MySQL container integration in an ARM64 architecture is not simple, so I tested it with MariaDB. Instead, I manually tested MySQL locally.)
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details here.