Skip to content
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9c793e2
feat(odbc source): add ODBC source for scheduled database queries
powerumc Apr 24, 2025
9e3f5d7
test(odbc source): Integration tests
powerumc Aug 25, 2025
f383c9f
test(odbc source): prepare Dockerfile
powerumc Sep 1, 2025
50fac18
feat(odbc source): implement ODBC metrics for event tracking
powerumc Sep 16, 2025
fa4502d
test(odbc source): integration test configuration
powerumc Sep 16, 2025
3090a4e
refactor(odbc source): introduce graceful shutdown and improve schedu…
powerumc Sep 16, 2025
e13b1a1
chore(odbc source): clean up formatting
powerumc Sep 16, 2025
f39ee28
test(odbc source): ODBC init_params, tracking_columns, last_run_metad…
powerumc Sep 21, 2025
831eb45
fix(odbc source): fix data type handling and comments
powerumc Sep 24, 2025
64fda4e
test(odbc source): number types integration test
powerumc Sep 24, 2025
e9037aa
test(odbc source): string types, other types integration test
powerumc Sep 28, 2025
b88c42e
chore(odbc source): clean up formatting
powerumc Sep 28, 2025
aef4174
feat(odbc source): add support for PostgreSQL and update integration …
powerumc Sep 29, 2025
32a566d
fix(odbc source): refactor test setup for consistency
powerumc Oct 4, 2025
8af2a13
test(odbc source): add integration test for timestamp columns
powerumc Oct 4, 2025
be3e3ef
docs(odbc source): add documentation for ODBC data source configuration
powerumc Oct 18, 2025
5dae7a7
Merge branch 'master' into powerumc/odbc-source
powerumc Oct 18, 2025
19cf895
test(odbc source): add external network configuration for MySQL and P…
powerumc Oct 18, 2025
15d4436
docs(odbc source): update source code documents.
powerumc Oct 21, 2025
1a3efcb
docs(odbc source): add comprehensive CUE configuration and documentat…
powerumc Oct 21, 2025
40d5795
chore(odbc source): source code formatting
powerumc Oct 21, 2025
c74a12a
refactor(odbc source): executes ODBC query processing with result tra…
powerumc Oct 21, 2025
cea0073
chore(deps): update odbc-api dependency to version 19.1.0
powerumc Oct 22, 2025
bb62426
chore(odbc source): update LICENSE-3rdparty.csv
powerumc Oct 22, 2025
6af628d
docs(odbc source): improve documentation clarity and update examples …
powerumc Oct 22, 2025
f4830ed
Merge branch 'master' into powerumc/odbc-source
powerumc Oct 22, 2025
3cb3d8f
chore(odbc source): update fmt and clippy
powerumc Oct 22, 2025
2a12364
chore(vdev): apply vdev rust check fixes
powerumc Oct 22, 2025
0b9c191
chore(vdev): apply vdev rust check fixes
powerumc Oct 22, 2025
ffc2a22
docs(odbc source): apply suggestion to odbc.cue
powerumc Oct 22, 2025
4c2e19b
docs(odbc source): apply suggestion to odbc.cue
powerumc Oct 22, 2025
ff66be0
docs(odbc source): apply suggestion to odbc.cue
powerumc Oct 22, 2025
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
571 changes: 535 additions & 36 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ deadpool = { version = "0.12.2", default-features = false, features = ["managed"
async-graphql = { version = "7.0.17", default-features = false, optional = true, features = ["chrono", "playground"] }
async-graphql-warp = { version = "7.0.17", default-features = false, optional = true }

# ODBC
odbc-api = { version = "19.1.0", optional = true }
cron = { version = "0.15.0", features = ["serde"], optional = true }

# Opentelemetry

hex = { version = "0.4.3", default-features = false, optional = true }
Expand Down Expand Up @@ -608,6 +612,7 @@ sources-logs = [
"sources-logstash",
"sources-mqtt",
"sources-nats",
"sources-odbc",
"sources-okta",
"sources-opentelemetry",
"sources-pulsar",
Expand Down Expand Up @@ -668,6 +673,7 @@ sources-mongodb_metrics = ["dep:mongodb"]
sources-mqtt = ["dep:rumqttc"]
sources-nats = ["dep:async-nats", "dep:nkeys"]
sources-nginx_metrics = ["dep:nom"]
sources-odbc = ["dep:odbc-api", "dep:cron"]
sources-okta = ["sources-utils-http-client"]
sources-opentelemetry = [
"dep:hex",
Expand Down Expand Up @@ -917,6 +923,7 @@ all-integration-tests = [
"mongodb_metrics-integration-tests",
"nats-integration-tests",
"nginx-integration-tests",
"odbc-integration-tests",
"opentelemetry-integration-tests",
"postgresql_metrics-integration-tests",
"postgres_sink-integration-tests",
Expand Down Expand Up @@ -982,6 +989,7 @@ mongodb_metrics-integration-tests = ["sources-mongodb_metrics"]
mqtt-integration-tests = ["sinks-mqtt", "sources-mqtt"]
nats-integration-tests = ["sinks-nats", "sources-nats"]
nginx-integration-tests = ["sources-nginx_metrics"]
odbc-integration-tests = ["sources-odbc"]
opentelemetry-integration-tests = ["sources-opentelemetry", "dep:prost"]
postgresql_metrics-integration-tests = ["sources-postgresql_metrics"]
postgres_sink-integration-tests = ["sinks-postgres"]
Expand Down
153 changes: 152 additions & 1 deletion LICENSE-3rdparty.csv

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions scripts/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g-dev \
unzip \
git \
unixodbc \
unixodbc-dev \
odbcinst \
odbc-mariadb \
odbc-postgresql \
&& rm -rf /var/lib/apt/lists/*

COPY tests/data/ca/certs /certs
Expand Down
17 changes: 17 additions & 0 deletions scripts/integration/odbc-mariadb/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'

services:
mariadb:
image: docker.io/mariadb:${CONFIG_VERSION}
ports:
- "3306:3306"
environment:
- MYSQL_USER=vector
- MYSQL_PASSWORD=vector
- MYSQL_ROOT_PASSWORD=vector
- MYSQL_DATABASE=vector_db

networks:
default:
name: ${VECTOR_NETWORK}
external: true
17 changes: 17 additions & 0 deletions scripts/integration/odbc-mariadb/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
features:
- odbc-integration-tests

test_filter: '::odbc::'

env:
ODBC_DB_TYPE: "mariadb"
ODBC_CONN_STRING: "driver={MariaDB Unicode};server=mariadb;port=3306;database=vector_db;uid=vector;pwd=vector;"

matrix:
version: [ '11-jammy' ]

# changes to these files/paths will invoke the integration test in CI
# expressions are evaluated using https://github.com/micromatch/picomatch
paths:
- "src/sources/odbc/**"
- "scripts/integration/odbc/**"
16 changes: 16 additions & 0 deletions scripts/integration/odbc-postgresql/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3'

services:
postgresql:
image: docker.io/postgres:${CONFIG_VERSION}
ports:
- "5432:5432"
environment:
- POSTGRES_USER=vector
- POSTGRES_PASSWORD=vector
- POSTGRES_DB=vector_db

networks:
default:
name: ${VECTOR_NETWORK}
external: true
17 changes: 17 additions & 0 deletions scripts/integration/odbc-postgresql/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
features:
- odbc-integration-tests

test_filter: '::odbc::'

env:
ODBC_DB_TYPE: "postgresql"
ODBC_CONN_STRING: "driver={PostgreSQL Unicode};server=postgresql;port=5432;database=vector_db;uid=vector;pwd=vector;"

matrix:
version: [ '16' ]

# changes to these files/paths will invoke the integration test in CI
# expressions are evaluated using https://github.com/micromatch/picomatch
paths:
- "src/sources/odbc/**"
- "scripts/integration/odbc/**"
6 changes: 6 additions & 0 deletions src/internal_events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ mod file;
#[cfg(windows)]
mod windows;

#[cfg(feature = "sources-odbc")]
mod odbc_metrics;

pub mod config;
#[cfg(any(feature = "transforms-log_to_metric", feature = "sinks-loki"))]
mod expansion;
Expand Down Expand Up @@ -248,6 +251,9 @@ pub(crate) use self::metric_to_log::*;
pub(crate) use self::mqtt::*;
#[cfg(feature = "sources-nginx_metrics")]
pub(crate) use self::nginx_metrics::*;
#[cfg(feature = "sources-odbc")]
pub(crate) use self::odbc_metrics::*;
#[allow(unused_imports)]
#[cfg(any(
feature = "sources-kubernetes_logs",
feature = "transforms-log_to_metric",
Expand Down
64 changes: 64 additions & 0 deletions src/internal_events/odbc_metrics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use metrics::counter;
use vector_common::internal_event::{InternalEvent, error_type};

#[derive(Debug)]
pub struct OdbcEventsReceived {
pub count: usize,
}

impl InternalEvent for OdbcEventsReceived {
fn emit(self) {
trace!(
message = "Events received.",
count = %self.count,
);
counter!(
"component_received_events_total",
"protocol" => "odbc"
)
.increment(self.count as u64);
counter!(
"component_received_event_bytes_total",
"protocol" => "odbc"
)
.increment(0);
}
}

#[derive(Debug)]
pub struct OdbcFailedError<'a> {
pub statement: &'a str,
}

impl InternalEvent for OdbcFailedError<'_> {
fn emit(self) {
error!(
message = "Unable to execute statement.",
statement = %self.statement,
error = error_type::COMMAND_FAILED
);
counter!(
"component_errors_total",
"statement" => self.statement.to_owned(),
"error_type" => error_type::COMMAND_FAILED
)
.increment(1);
}
}

#[derive(Debug)]
pub struct OdbcQueryExecuted<'a> {
pub statement: &'a str,
pub elapsed: u128,
}

impl InternalEvent for OdbcQueryExecuted<'_> {
fn emit(self) {
trace!(
message = "Executed statement.",
statement = %self.statement,
elapsedMs = %self.elapsed
);
counter!("component_executed_events_total").increment(1);
}
}
2 changes: 2 additions & 0 deletions src/sources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ pub mod mqtt;
pub mod nats;
#[cfg(feature = "sources-nginx_metrics")]
pub mod nginx_metrics;
#[cfg(feature = "sources-odbc")]
pub mod odbc;
#[cfg(feature = "sources-okta")]
pub mod okta;
#[cfg(feature = "sources-opentelemetry")]
Expand Down
46 changes: 46 additions & 0 deletions src/sources/odbc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ODBC Development

## Setup

#### MacOS

```shell
brew install unixodbc

Check failure on line 8 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`unixodbc` is not a recognized word. (unrecognized-spelling)

brew install [email protected] # Install MariaDB ODBC, and you need to configure odbcinst.ini.

Check failure on line 10 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`odbcinst` is not a recognized word. (unrecognized-spelling)

Check failure on line 10 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`mariadb` is not a recognized word. (unrecognized-spelling)
```

Refs

- MySQL Connector/ODBC: <https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-binary-macos.html>
- MariaDB Connector/ODBC: <https://mariadb.com/kb/en/about-mariadb-connector-odbc/>
- Homebrew mariadb-connector-odbc: <https://formulae.brew.sh/formula/mariadb-connector-odbc>

Check failure on line 17 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`mariadb` is not a recognized word. (unrecognized-spelling)

Check warning on line 17 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`mariadb` is not a recognized word. (unrecognized-spelling)

Check warning on line 17 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`mariadb` is not a recognized word. (unrecognized-spelling)
- ODBC Configuration: <https://mariadb.com/kb/en/creating-a-data-source-with-mariadb-connectorodbc/>
```shell
cat << EOF >> /opt/homebrew/etc/odbcinst.ini

Check warning on line 20 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`odbcinst` is not a recognized word. (unrecognized-spelling)

[MariaDB ODBC 3.0 Driver]
Description = MariaDB Connector/ODBC v.3.0
Driver = /opt/homebrew/Cellar/mariadb-connector-odbc/3.2.6/lib/mariadb/libmaodbc.dylib

Check failure on line 24 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`libmaodbc` is not a recognized word. (unrecognized-spelling)

Check warning on line 24 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`mariadb` is not a recognized word. (unrecognized-spelling)

Check warning on line 24 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`mariadb` is not a recognized word. (unrecognized-spelling)
EOF
```
- MSSQL
Connector/ODBC: <https://learn.microsoft.com/ko-kr/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver16>

## ODBC Tips

Show ODBC configuration

```shell
odbcinst -j

Check warning on line 35 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`odbcinst` is not a recognized word. (unrecognized-spelling)

### Output Example ###
# unixODBC 2.3.12
# DRIVERS............: /opt/homebrew/etc/odbcinst.ini

Check warning on line 39 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`odbcinst` is not a recognized word. (unrecognized-spelling)
# SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini
# FILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSources
# USER DATA SOURCES..: /Users/powerumc/.odbc.ini

Check failure on line 42 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`powerumc` is not a recognized word. (unrecognized-spelling)
# SQLULEN Size.......: 8

Check failure on line 43 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`SQLULEN` is not a recognized word. (unrecognized-spelling)
# SQLLEN Size........: 8

Check failure on line 44 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`SQLLEN` is not a recognized word. (unrecognized-spelling)
# SQLSETPOSIROW Size.: 8

Check failure on line 45 in src/sources/odbc/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`SQLSETPOSIROW` is not a recognized word. (unrecognized-spelling)
```
Loading
Loading