From f4c56e1597956cd95eb37336e0c08ae361338aba Mon Sep 17 00:00:00 2001 From: michelle-costa <78615815+michelle-costa@users.noreply.github.com> Date: Thu, 5 Oct 2023 04:26:40 -0300 Subject: [PATCH] feat(inputs.sql): Add oracle driver (#13978) --- docs/LICENSE_OF_DEPENDENCIES.md | 1 + docs/SQL_DRIVERS_INPUT.md | 1 + go.mod | 1 + go.sum | 2 ++ plugins/inputs/sql/drivers.go | 1 + plugins/inputs/sql/sql.go | 1 + 6 files changed, 7 insertions(+) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 7710cceaa..7ef77d162 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -312,6 +312,7 @@ following works: - github.com/signalfx/gohistogram [MIT License](https://github.com/signalfx/gohistogram/blob/master/LICENSE) - github.com/signalfx/golib [Apache License 2.0](https://github.com/signalfx/golib/blob/master/LICENSE) - github.com/signalfx/sapm-proto [Apache License 2.0](https://github.com/signalfx/sapm-proto/blob/master/LICENSE) +- github.com/sijms/go-ora [MIT License](https://github.com/sijms/go-ora/blob/master/LICENSE) - github.com/sirupsen/logrus [MIT License](https://github.com/sirupsen/logrus/blob/master/LICENSE) - github.com/sleepinggenius2/gosmi [MIT License](https://github.com/sleepinggenius2/gosmi/blob/master/LICENSE) - github.com/snowflakedb/gosnowflake [Apache License 2.0](https://github.com/snowflakedb/gosnowflake/blob/master/LICENSE) diff --git a/docs/SQL_DRIVERS_INPUT.md b/docs/SQL_DRIVERS_INPUT.md index 9f29b52f7..7d1606dc9 100644 --- a/docs/SQL_DRIVERS_INPUT.md +++ b/docs/SQL_DRIVERS_INPUT.md @@ -14,6 +14,7 @@ might change between versions. Please check the driver documentation for availab | SQLite | [sqlite](https://gitlab.com/cznic/sqlite) | | `filename` | see [driver docs](https://pkg.go.dev/modernc.org/sqlite) for more information | | TiDB | [tidb](https://github.com/go-sql-driver/mysql) | mysql | see _mysql_ driver | uses MySQL driver | | ClickHouse | [clickhouse](https://github.com/ClickHouse/clickhouse-go) | | `tcp://host:port[?param1=value&...¶mN=value]"` | see [clickhouse-go docs](https://github.com/ClickHouse/clickhouse-go#dsn) for more information | +| Oracle | [oracle](https://github.com/sijms/go-ora) | oracle | `oracle://username:password@host:port/service?param1=value¶m2=value` | see [driver docs](https://github.com/sijms/go-ora/blob/master/README.md) for more information | ## Comments diff --git a/go.mod b/go.mod index c9d69eb83..20a0a1d37 100644 --- a/go.mod +++ b/go.mod @@ -422,6 +422,7 @@ require ( github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3 // indirect github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083 // indirect github.com/signalfx/sapm-proto v0.12.0 // indirect + github.com/sijms/go-ora/v2 v2.7.18 github.com/spf13/cast v1.5.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect diff --git a/go.sum b/go.sum index 3c37b74bf..cf1e63c3b 100644 --- a/go.sum +++ b/go.sum @@ -1378,6 +1378,8 @@ github.com/signalfx/golib/v3 v3.3.53 h1:gJx0JrrHjidpo2md+YLEN+Ws3RLTaCmKYT575ZST github.com/signalfx/golib/v3 v3.3.53/go.mod h1:lgdUNXjNnZkgEhQFSbfyek4oFUG8t1APhGaitZsSBzc= github.com/signalfx/sapm-proto v0.12.0 h1:OtOe+Jm8L61Ml8K6X8a89zc8/RlaaMRElCImeGKR/Ew= github.com/signalfx/sapm-proto v0.12.0/go.mod h1:wQEki8RNCYjkv19jw5aWDcmDMTQru0ckfUbgHI69U2E= +github.com/sijms/go-ora/v2 v2.7.18 h1:xl9CUeBlFi261AOKekiiFnfcp3ojHFEedLxIzsj909E= +github.com/sijms/go-ora/v2 v2.7.18/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= diff --git a/plugins/inputs/sql/drivers.go b/plugins/inputs/sql/drivers.go index ea8a6053f..07e67b6df 100644 --- a/plugins/inputs/sql/drivers.go +++ b/plugins/inputs/sql/drivers.go @@ -7,4 +7,5 @@ import ( _ "github.com/go-sql-driver/mysql" _ "github.com/jackc/pgx/v4/stdlib" _ "github.com/microsoft/go-mssqldb" + _ "github.com/sijms/go-ora/v2" ) diff --git a/plugins/inputs/sql/sql.go b/plugins/inputs/sql/sql.go index b38490758..1d93a08bd 100644 --- a/plugins/inputs/sql/sql.go +++ b/plugins/inputs/sql/sql.go @@ -327,6 +327,7 @@ func (s *SQL) Init() error { "mssql": "sqlserver", "maria": "mysql", "postgres": "pgx", + "oracle": "oracle", } s.driverName = s.Driver if driver, ok := aliases[s.Driver]; ok {