Skip to content

Commit

Permalink
Added support for SAP Sybase Database. (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
miransar authored Mar 14, 2024
1 parent d2e1e69 commit a076375
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/sybase-database-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# NOTE: 'database' is an experimental API at this time
# ref: https://github.com/newrelic/nri-flex/blob/master/docs/experimental/db.md
---
integrations:
- name: nri-flex
# interval: 30s
config:
name: sybaseDbFlex
apis:
- database: sybase
db_conn: ase://user:pass@host:port/
logging:
open: true
custom_attributes: # applies to all queries
host: myDbServer
db_async: true # process queries async
db_queries:
- name: sybaseExample
run: select * from data
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/SAP/go-ase v0.0.0-20230911093826-e06baafeece3 // indirect
github.com/SAP/go-dblib v0.0.0-20220825075032-c1f3f4d6e7b3 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
Expand All @@ -60,6 +62,8 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand Down
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ github.com/MonetDB/MonetDB-Go v1.0.2 h1:ovqY//8De9OzoJJbc1YkW4peNfGdLTgQhjc+fhBr
github.com/MonetDB/MonetDB-Go v1.0.2/go.mod h1:camniXrjGJnMoXXgZWhUY+2nKPVfjKmcA5mmrjuV2+A=
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg=
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/SAP/go-ase v0.0.0-20230911093826-e06baafeece3 h1:S2BdRIWytdt7gHV+39ZC9Fl8PbQlhlnWmBfQTy7iSUg=
github.com/SAP/go-ase v0.0.0-20230911093826-e06baafeece3/go.mod h1:RJNsL+XbiV4Ux3aTLlk5WIQy6kq6VW7OvAasNkq3j4U=
github.com/SAP/go-dblib v0.0.0-20220825075032-c1f3f4d6e7b3 h1:bX6dkWrQMTAO8IwVGZqXoNdWjZVQ3YnRU01p+x4X+Jw=
github.com/SAP/go-dblib v0.0.0-20220825075032-c1f3f4d6e7b3/go.mod h1:pyB1BEipxjxMcCYlymW+x6sgucc0N45V7LVPUnpDr/I=
github.com/SAP/go-hdb v0.107.3 h1:tX7CI+fsUFVNzR9LIAuX1mzyzRtuMiUkvuVVUgNSGss=
github.com/SAP/go-hdb v0.107.3/go.mod h1:EAlLPK5So38imnv2/aBADHZBjl76RVIWvu9Tkiu6LbY=
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI=
Expand Down Expand Up @@ -199,6 +203,11 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down
3 changes: 3 additions & 0 deletions internal/inputs/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

//Database Drivers
_ "github.com/MonetDB/MonetDB-Go/src" //MonetDB
_ "github.com/SAP/go-ase" //Sybase
_ "github.com/SAP/go-hdb/driver" //SAP HANA
_ "github.com/denisenkom/go-mssqldb" //mssql | sql-server
_ "github.com/go-sql-driver/mysql" //mysql
Expand Down Expand Up @@ -227,6 +228,8 @@ func setDatabaseDriver(database, driver string, yml *load.Config, api load.API)
return load.DefaultMySQL
case "oracle":
return load.DefaultOracle
case "sybase":
return load.DefaultSybase
case "monetdb":
return load.DefaultMonetDB
case "hana", "go-hdb", "hdb":
Expand Down
1 change: 1 addition & 0 deletions internal/inputs/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestDrivers(t *testing.T) {
"mariadb": load.DefaultMySQL,
"hana": load.DefaultHANA,
"oracle": load.DefaultOracle,
"ase": load.DefaultSybase,
"monetdb": load.DefaultMonetDB,
"unknown": "",
}
Expand Down
1 change: 1 addition & 0 deletions internal/load/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const (
DefaultMSSQLServer = "sqlserver"
DefaultMySQL = "mysql"
DefaultOracle = "oracle"
DefaultSybase = "ase"
DefaultMonetDB = "monetdb"
DefaultVertica = "vertica"
DefaultJmxHost = "127.0.0.1"
Expand Down

0 comments on commit a076375

Please sign in to comment.