Skip to content

Commit

Permalink
Merge pull request #59 from newrelic/adias/fix-db-connections
Browse files Browse the repository at this point in the history
feat: add option to disable connection pool
  • Loading branch information
arvdias authored Dec 3, 2020
2 parents c77d56b + a2026e6 commit 65f3a48
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions src/oracledb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ import (

type argumentList struct {
sdkArgs.DefaultArgumentList
ServiceName string `default:"" help:"The Oracle service name"`
Username string `default:"" help:"The OracleDB connection user name"`
Password string `default:"" help:"The OracleDB connection password"`
IsSysDBA bool `default:"false" help:"Is the user a SysDBA"`
IsSysOper bool `default:"false" help:"Is the user a SysOper"`
Hostname string `default:"127.0.0.1" help:"The OracleDB connection host name"`
Tablespaces string `default:"" help:"JSON Array of Tablespaces to collect. If empty will collect all tablespaces."`
Port string `default:"1521" help:"The OracleDB connection port"`
ExtendedMetrics bool `default:"false" help:"Enable extended metrics"`
MaxOpenConnections int `default:"5" help:"Maximum number of connections opened by the integration"`
ConnectionString string `default:"" help:"An advanced connection string. Takes precedence over host, port, and service name"`
CustomMetricsQuery string `default:"" help:"A SQL query to collect custom metrics. Must have the columns metric_name, metric_type, and metric_value. Additional columns are added as attributes"`
CustomMetricsConfig string `default:"" help:"YAML configuration file with one or more custom SQL queries to collect"`
ServiceName string `default:"" help:"The Oracle service name"`
Username string `default:"" help:"The OracleDB connection user name"`
Password string `default:"" help:"The OracleDB connection password"`
IsSysDBA bool `default:"false" help:"Is the user a SysDBA"`
IsSysOper bool `default:"false" help:"Is the user a SysOper"`
Hostname string `default:"127.0.0.1" help:"The OracleDB connection host name"`
Tablespaces string `default:"" help:"JSON Array of Tablespaces to collect. If empty will collect all tablespaces."`
Port string `default:"1521" help:"The OracleDB connection port"`
ExtendedMetrics bool `default:"false" help:"Enable extended metrics"`
MaxOpenConnections int `default:"5" help:"Maximum number of connections opened by the integration"`
ConnectionString string `default:"" help:"An advanced connection string. Takes precedence over host, port, and service name"`
CustomMetricsQuery string `default:"" help:"A SQL query to collect custom metrics. Must have the columns metric_name, metric_type, and metric_value. Additional columns are added as attributes"`
CustomMetricsConfig string `default:"" help:"YAML configuration file with one or more custom SQL queries to collect"`
DisableConnectionPool bool `default:"false" help:"Disables connection pooling. It may make the integration run slower but may reduce issues with not being able to execute queries due to ORA-24459 (failure to get new connection)"`
}

const (
Expand Down Expand Up @@ -94,14 +95,15 @@ func getConnectionString() string {
}

cp := goracle.ConnectionParams{
Username: args.Username,
Password: args.Password,
SID: sid,
IsSysDBA: args.IsSysDBA,
IsSysOper: args.IsSysOper,
MinSessions: 0,
MaxSessions: args.MaxOpenConnections,
PoolIncrement: 1,
Username: args.Username,
Password: args.Password,
SID: sid,
IsSysDBA: args.IsSysDBA,
IsSysOper: args.IsSysOper,
StandaloneConnection: args.DisableConnectionPool,
MinSessions: 0,
MaxSessions: args.MaxOpenConnections,
PoolIncrement: 1,
}

return cp.StringWithPassword()
Expand Down

0 comments on commit 65f3a48

Please sign in to comment.