Skip to content

Commit

Permalink
fix: use BLOCK_SIZE to calculate tablespaces metrics in bytes (#94)
Browse files Browse the repository at this point in the history
* fix: use BLOCK_SIZE to calculate tablespaces metrics in bytes
* fix: remove k8s sample
  • Loading branch information
gsanchezgavier authored Feb 17, 2022
1 parent a091e99 commit 7ec3933
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 61 deletions.
42 changes: 0 additions & 42 deletions oracledb-config.yml.k8s_sample

This file was deleted.

23 changes: 4 additions & 19 deletions src/metric_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ var oracleSysstat = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricsChan chan<- newrelicMetricSender) error {

var sysScanner struct {
value int
instID int
Expand Down Expand Up @@ -574,7 +573,6 @@ var oracleSGA = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricsChan chan<- newrelicMetricSender) error {

var sysScanner struct {
value int
instID int
Expand Down Expand Up @@ -714,7 +712,6 @@ var oracleRedoLogWaits = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricsChan chan<- newrelicMetricSender) error {

var sysScanner struct {
totalWaits int
instID int
Expand Down Expand Up @@ -794,7 +791,6 @@ var oraclePDBDatafilesOffline = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

columnNames, err := rows.Columns()
if err != nil {
return fmt.Errorf("failed to retrieve columns from rows")
Expand Down Expand Up @@ -881,7 +877,6 @@ var oracleCDBDatafilesOffline = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

columnNames, err := rows.Columns()
if err != nil {
return fmt.Errorf("failed to retrieve columns from rows")
Expand Down Expand Up @@ -958,7 +953,6 @@ var oracleLockedAccounts = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

columnNames, err := rows.Columns()
if err != nil {
return fmt.Errorf("failed to retrieve columns from rows")
Expand Down Expand Up @@ -1030,7 +1024,6 @@ var oraclePDBNonWrite = oracleMetricGroup{
query += `
GROUP BY TABLESPACE_NAME`
return query

},

metrics: []*oracleMetric{
Expand All @@ -1043,7 +1036,6 @@ var oraclePDBNonWrite = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

columnNames, err := rows.Columns()
if err != nil {
return fmt.Errorf("failed to retrieve columns from rows")
Expand Down Expand Up @@ -1095,16 +1087,17 @@ var oracleTablespaceMetrics = oracleMetricGroup{
query := `
SELECT a.TABLESPACE_NAME,
a.USED_PERCENT,
a.USED_SPACE AS "USED",
a.TABLESPACE_SIZE AS "SIZE",
a.USED_SPACE * b.BLOCK_SIZE AS "USED",
a.TABLESPACE_SIZE * b.BLOCK_SIZE AS "SIZE",
b.TABLESPACE_OFFLINE AS "OFFLINE"
FROM DBA_TABLESPACE_USAGE_METRICS a
JOIN (
SELECT
TABLESPACE_NAME,
BLOCK_SIZE,
MAX( CASE WHEN status = 'OFFLINE' THEN 1 ELSE 0 END) AS "TABLESPACE_OFFLINE"
FROM DBA_TABLESPACES
GROUP BY TABLESPACE_NAME
GROUP BY TABLESPACE_NAME, BLOCK_SIZE
) b
ON a.TABLESPACE_NAME = b.TABLESPACE_NAME`

Expand Down Expand Up @@ -1154,7 +1147,6 @@ var oracleTablespaceMetrics = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

columnNames, err := rows.Columns()
if err != nil {
return fmt.Errorf("failed to retrieve columns from rows")
Expand Down Expand Up @@ -1225,7 +1217,6 @@ var globalNameInstanceMetric = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

type pgaRow struct {
instID int
value string
Expand Down Expand Up @@ -1282,7 +1273,6 @@ var globalNameTablespaceMetric = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

type pgaRow struct {
tableName string
value string
Expand Down Expand Up @@ -1339,7 +1329,6 @@ var dbIDInstanceMetric = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

type pgaRow struct {
instID int
value string
Expand Down Expand Up @@ -1396,7 +1385,6 @@ var dbIDTablespaceMetric = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

type pgaRow struct {
tableName string
value string
Expand Down Expand Up @@ -1488,7 +1476,6 @@ var oracleReadWriteMetrics = oracleMetricGroup{
},

metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

columnNames, err := rows.Columns()
if err != nil {
return fmt.Errorf("failed to get column names from rows")
Expand Down Expand Up @@ -1568,7 +1555,6 @@ var oraclePgaMetrics = oracleMetricGroup{
},
},
metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricChan chan<- newrelicMetricSender) error {

type pgaRow struct {
instID int
name string
Expand Down Expand Up @@ -2423,7 +2409,6 @@ var oracleSysMetrics = oracleMetricGroup{
},
},
metricsGenerator: func(rows database.Rows, metrics []*oracleMetric, metricsChan chan<- newrelicMetricSender) error {

var sysScanner struct {
instID int
metricName string
Expand Down

0 comments on commit 7ec3933

Please sign in to comment.