diff --git a/.chloggen/oracledbreceiver-impl.yaml b/.chloggen/oracledbreceiver-impl.yaml new file mode 100644 index 000000000000..731fda889ce2 --- /dev/null +++ b/.chloggen/oracledbreceiver-impl.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: oracledbreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add oracledbreceiver implementation (config, scraper, db client) + +# One or more tracking issues related to the change +issues: [16043] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/receiver/oracledbreceiver/README.md b/receiver/oracledbreceiver/README.md index 27006891e15a..74305d19ca21 100644 --- a/receiver/oracledbreceiver/README.md +++ b/receiver/oracledbreceiver/README.md @@ -10,4 +10,51 @@ This receiver collects metrics from an Oracle Database. The receiver connects to a database host and performs periodically queries. +Supported pipeline types: metrics + +## Getting Started + +The following settings are required: + +- `datasource`: Oracle database connection string. Refer to Oracle Go Driver go_ora documentation for full connection string options. + +Example: + +```yaml +receivers: + oracledb: + datasource: "oracle://otel:password@localhost:51521/XE" +``` + +## Permissions + +Depending on which metrics you collect, you will need to assign those permissions to the database user: +``` +GRANT SELECT ON V_$SESSION TO ; +GRANT SELECT ON V_$SYSSTAT TO ; +GRANT SELECT ON V_$RESOURCE_LIMIT TO ; +GRANT SELECT ON DBA_TABLESPACES TO ; +GRANT SELECT ON DBA_DATA_FILES TO ; +``` + +## Enabling metrics. + +See [documentation.md]. + +You can enable or disable selective metrics. + +Example: + +```yaml +receivers: + oracledb: + datasource: "oracle://otel:password@localhost:51521/XE" + metrics: + oracledb.query.cpu_time: + enabled: false + oracledb.query.physical_read_requests: + enabled: true +``` + [development]: https://github.com/open-telemetry/opentelemetry-collector#development + diff --git a/receiver/oracledbreceiver/config.go b/receiver/oracledbreceiver/config.go index e8d56b2b9350..374ea40a8934 100644 --- a/receiver/oracledbreceiver/config.go +++ b/receiver/oracledbreceiver/config.go @@ -14,8 +14,42 @@ package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver" -import "go.opentelemetry.io/collector/config" +import ( + "errors" + "fmt" + "net/url" + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver/internal/metadata" +) type Config struct { - config.ReceiverSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct + config.ReceiverSettings `mapstructure:",squash"` + DataSource string `mapstructure:"datasource"` + scraperhelper.ScraperControllerSettings `mapstructure:",squash"` + MetricsSettings metadata.MetricsSettings `mapstructure:"metrics"` +} + +func (c Config) Validate() error { + if c.DataSource == "" { + return errors.New("'datasource' cannot be empty") + } + if _, err := url.Parse(c.DataSource); err != nil { + return fmt.Errorf("'datasource' is invalid: %w", err) + } + return nil +} + +func CreateDefaultConfig() component.Config { + return &Config{ + ScraperControllerSettings: scraperhelper.ScraperControllerSettings{ + ReceiverSettings: config.NewReceiverSettings(component.NewID(typeStr)), + CollectionInterval: 10 * time.Second, + }, + MetricsSettings: metadata.DefaultMetricsSettings(), + } } diff --git a/receiver/oracledbreceiver/config_test.go b/receiver/oracledbreceiver/config_test.go new file mode 100644 index 000000000000..755a68364f4d --- /dev/null +++ b/receiver/oracledbreceiver/config_test.go @@ -0,0 +1,46 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oracledbreceiver // import "github.com/open-telemetry/open-telemetry-collector-contrib/receiver/oracledbreceiver" + +import ( + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap/confmaptest" +) + +func TestCreateDefaultConfig(t *testing.T) { + cfg := CreateDefaultConfig().(*Config) + assert.Equal(t, 10*time.Second, cfg.ScraperControllerSettings.CollectionInterval) +} + +func TestParseConfig(t *testing.T) { + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml")) + require.NoError(t, err) + sub, err := cm.Sub("oracledb") + require.NoError(t, err) + cfg := CreateDefaultConfig().(*Config) + + require.NoError(t, err) + require.NoError(t, component.UnmarshalConfig(sub, cfg)) + assert.Equal(t, "oracle://otel:password@localhost:51521/XE", cfg.DataSource) + settings := cfg.MetricsSettings + assert.False(t, settings.OracledbTablespaceSizeUsage.Enabled) + assert.False(t, settings.OracledbExchangeDeadlocks.Enabled) +} diff --git a/receiver/oracledbreceiver/db_client.go b/receiver/oracledbreceiver/db_client.go new file mode 100644 index 000000000000..f929c8394bc8 --- /dev/null +++ b/receiver/oracledbreceiver/db_client.go @@ -0,0 +1,102 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver" + +import ( + "context" + "database/sql" + "fmt" + "reflect" + "strings" + + // register db driver + _ "github.com/sijms/go-ora/v2" + "go.uber.org/zap" +) + +// This will be removed and imported from pkg/sqlquery once https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/14321 is merged. +type dbClient interface { + metricRows(ctx context.Context) ([]metricRow, error) +} + +type metricRow map[string]string + +type dbSQLClient struct { + db *sql.DB + logger *zap.Logger + sql string +} + +func newDbClient(db *sql.DB, sql string, logger *zap.Logger) dbClient { + return dbSQLClient{ + db: db, + sql: sql, + logger: logger, + } +} + +func (cl dbSQLClient) metricRows(ctx context.Context) ([]metricRow, error) { + sqlRows, err := cl.db.QueryContext(ctx, cl.sql) + if err != nil { + return nil, err + } + var out []metricRow + row := reusableRow{ + attrs: map[string]func() string{}, + } + types, err := sqlRows.ColumnTypes() + if err != nil { + return nil, err + } + for _, sqlType := range types { + colName := sqlType.Name() + var v interface{} + row.attrs[colName] = func() string { + format := "%v" + if v == nil { + return "" + } + if reflect.TypeOf(v).Kind() == reflect.Slice { + // The Postgres driver returns a []uint8 (a string) for decimal and numeric types, + // which we want to render as strings. e.g. "4.1" instead of "[52, 46, 49]". + // Other slice types get the same treatment. + format = "%s" + } + return fmt.Sprintf(format, v) + } + row.scanDest = append(row.scanDest, &v) + } + for sqlRows.Next() { + err = sqlRows.Scan(row.scanDest...) + if err != nil { + return nil, err + } + out = append(out, row.toMetricRow()) + } + return out, nil +} + +type reusableRow struct { + attrs map[string]func() string + scanDest []interface{} +} + +func (row reusableRow) toMetricRow() metricRow { + out := metricRow{} + for k, f := range row.attrs { + out[strings.ToUpper(k)] = f() + } + return out +} diff --git a/receiver/oracledbreceiver/factory.go b/receiver/oracledbreceiver/factory.go index 47966c596514..a29eb11a5502 100644 --- a/receiver/oracledbreceiver/factory.go +++ b/receiver/oracledbreceiver/factory.go @@ -16,10 +16,16 @@ package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-coll import ( "context" + "database/sql" + "net/url" + "time" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver/internal/metadata" ) const ( @@ -32,13 +38,49 @@ func NewFactory() component.ReceiverFactory { return component.NewReceiverFactory( typeStr, createDefaultConfig, - component.WithMetricsReceiver(createMetricsReceiver, stability)) + component.WithMetricsReceiver(createReceiverFunc(func(dataSourceName string) (*sql.DB, error) { + return sql.Open("oracle", dataSourceName) + }, newDbClient), stability)) } -func createMetricsReceiver(ctx context.Context, settings component.ReceiverCreateSettings, receiver component.Config, metrics consumer.Metrics) (component.MetricsReceiver, error) { - return &oracledbreceiver{}, nil +func createDefaultConfig() component.Config { + return &Config{ + ReceiverSettings: config.NewReceiverSettings(component.NewID(typeStr)), + ScraperControllerSettings: scraperhelper.ScraperControllerSettings{ + ReceiverSettings: config.NewReceiverSettings(component.NewID(typeStr)), + CollectionInterval: 10 * time.Second, + }, + MetricsSettings: metadata.DefaultMetricsSettings(), + } } -func createDefaultConfig() component.Config { - return &Config{ReceiverSettings: config.NewReceiverSettings(component.NewID(typeStr))} +type sqlOpenerFunc func(dataSourceName string) (*sql.DB, error) + +func createReceiverFunc(sqlOpenerFunc sqlOpenerFunc, clientProviderFunc clientProviderFunc) component.CreateMetricsReceiverFunc { + return func( + ctx context.Context, + settings component.ReceiverCreateSettings, + cfg component.Config, + consumer consumer.Metrics, + ) (component.MetricsReceiver, error) { + sqlCfg := cfg.(*Config) + metricsBuilder := metadata.NewMetricsBuilder(sqlCfg.MetricsSettings, settings) + datasourceURL, _ := url.Parse(sqlCfg.DataSource) + instanceName := datasourceURL.Host + + mp, err := newScraper(settings.ID, metricsBuilder, sqlCfg.MetricsSettings, sqlCfg.ScraperControllerSettings, settings.TelemetrySettings.Logger, func() (*sql.DB, error) { + return sqlOpenerFunc(sqlCfg.DataSource) + }, clientProviderFunc, instanceName) + if err != nil { + return nil, err + } + opt := scraperhelper.AddScraper(mp) + + return scraperhelper.NewScraperControllerReceiver( + &sqlCfg.ScraperControllerSettings, + settings, + consumer, + opt, + ) + } } diff --git a/receiver/oracledbreceiver/factory_test.go b/receiver/oracledbreceiver/factory_test.go new file mode 100644 index 000000000000..cd337f7795bf --- /dev/null +++ b/receiver/oracledbreceiver/factory_test.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oracledbreceiver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/trace" +) + +func TestNewFactory(t *testing.T) { + factory := NewFactory() + _, err := factory.CreateMetricsReceiver( + context.Background(), + component.ReceiverCreateSettings{ + TelemetrySettings: component.TelemetrySettings{ + TracerProvider: trace.NewNoopTracerProvider(), + MeterProvider: metric.NewNoopMeterProvider(), + }, + }, + factory.CreateDefaultConfig(), + consumertest.NewNop(), + ) + require.NoError(t, err) +} diff --git a/receiver/oracledbreceiver/receiver.go b/receiver/oracledbreceiver/fake_db_client.go similarity index 72% rename from receiver/oracledbreceiver/receiver.go rename to receiver/oracledbreceiver/fake_db_client.go index 4e150a8f4ebc..51e917221400 100644 --- a/receiver/oracledbreceiver/receiver.go +++ b/receiver/oracledbreceiver/fake_db_client.go @@ -13,19 +13,22 @@ // limitations under the License. package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver" + import ( "context" - - "go.opentelemetry.io/collector/component" ) -type oracledbreceiver struct { -} - -func (o oracledbreceiver) Start(_ context.Context, host component.Host) error { - return nil +type fakeDbClient struct { + Err error + Responses [][]metricRow + RequestCounter int } -func (o oracledbreceiver) Shutdown(_ context.Context) error { - return nil +func (c *fakeDbClient) metricRows(context.Context) ([]metricRow, error) { + if c.Err != nil { + return nil, c.Err + } + idx := c.RequestCounter + c.RequestCounter++ + return c.Responses[idx], nil } diff --git a/receiver/oracledbreceiver/go.mod b/receiver/oracledbreceiver/go.mod index ab6a0a8645ae..cec2f15aa9ce 100644 --- a/receiver/oracledbreceiver/go.mod +++ b/receiver/oracledbreceiver/go.mod @@ -3,12 +3,16 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracle go 1.18 require ( + github.com/sijms/go-ora/v2 v2.5.3 github.com/stretchr/testify v1.8.1 go.opentelemetry.io/collector v0.66.1-0.20221202005155-1c54042beb70 go.opentelemetry.io/collector/component v0.66.1-0.20221202005155-1c54042beb70 go.opentelemetry.io/collector/confmap v0.0.0-20221201172708-2bdff61fa52a go.opentelemetry.io/collector/consumer v0.66.1-0.20221202005155-1c54042beb70 go.opentelemetry.io/collector/pdata v0.66.1-0.20221202005155-1c54042beb70 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/trace v1.11.1 + go.uber.org/multierr v1.8.0 go.uber.org/zap v1.24.0 ) @@ -24,12 +28,10 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/collector/featuregate v0.66.1-0.20221202005155-1c54042beb70 // indirect go.opentelemetry.io/otel v1.11.1 // indirect - go.opentelemetry.io/otel/metric v0.33.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.8.0 // indirect golang.org/x/net v0.3.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/receiver/oracledbreceiver/go.sum b/receiver/oracledbreceiver/go.sum index 764af4a7bede..3aff3e47d0d1 100644 --- a/receiver/oracledbreceiver/go.sum +++ b/receiver/oracledbreceiver/go.sum @@ -1,5 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -25,11 +26,14 @@ github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAm github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -56,10 +60,14 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -67,6 +75,8 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -90,6 +100,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -168,6 +179,7 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= @@ -215,23 +227,30 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/statsd_exporter v0.22.7 h1:7Pji/i2GuhK6Lu7DHrtTkFmNBCudCPT1pX2CziuyQR0= github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sijms/go-ora/v2 v2.5.3 h1:klGKmhqRONVTtIzTdfYTvrW94kdJkdmZl93u2A3vchI= +github.com/sijms/go-ora/v2 v2.5.3/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -257,6 +276,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/collector v0.66.1-0.20221202005155-1c54042beb70 h1:INB2CsOtqqrija2KvMuIpbBQ3qX1BECEeR+d0NJX+oM= go.opentelemetry.io/collector v0.66.1-0.20221202005155-1c54042beb70/go.mod h1:d0NHkHyANJy3HDTvYE/PoylMShUmFIbiir89ieI0X0c= go.opentelemetry.io/collector/component v0.66.1-0.20221202005155-1c54042beb70 h1:dEoJhzCmRShgmVro/kXm6pouGElgxkH2DsvanzCeZtU= @@ -271,8 +292,11 @@ go.opentelemetry.io/collector/pdata v0.66.1-0.20221202005155-1c54042beb70 h1:TPO go.opentelemetry.io/collector/pdata v0.66.1-0.20221202005155-1c54042beb70/go.mod h1:pqyaznLzk21m+1KL6fwOsRryRELL+zNM0qiVSn0MbVc= go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= +go.opentelemetry.io/otel/exporters/prometheus v0.33.0 h1:xXhPj7SLKWU5/Zd4Hxmd+X1C4jdmvc0Xy+kvjFx2z60= go.opentelemetry.io/otel/metric v0.33.0 h1:xQAyl7uGEYvrLAiV/09iTJlp1pZnQ9Wl793qbVvED1E= go.opentelemetry.io/otel/metric v0.33.0/go.mod h1:QlTYc+EnYNq/M2mNk1qDDMRLpqCOj2f/r5c7Fd5FYaI= +go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= +go.opentelemetry.io/otel/sdk/metric v0.33.0 h1:oTqyWfksgKoJmbrs2q7O7ahkJzt+Ipekihf8vhpa9qo= go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= @@ -314,6 +338,7 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= @@ -405,6 +430,7 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= @@ -437,6 +463,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/receiver/oracledbreceiver/internal/metadata/generated_metrics.go b/receiver/oracledbreceiver/internal/metadata/generated_metrics.go index c0dba74a0d77..9ca5392369fb 100644 --- a/receiver/oracledbreceiver/internal/metadata/generated_metrics.go +++ b/receiver/oracledbreceiver/internal/metadata/generated_metrics.go @@ -3,6 +3,8 @@ package metadata import ( + "fmt" + "strconv" "time" "go.opentelemetry.io/collector/component" @@ -1582,123 +1584,243 @@ func (mb *MetricsBuilder) RecordOracledbCPUTimeDataPoint(ts pcommon.Timestamp, v } // RecordOracledbDmlLocksLimitDataPoint adds a data point to oracledb.dml_locks.limit metric. -func (mb *MetricsBuilder) RecordOracledbDmlLocksLimitDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbDmlLocksLimitDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbDmlLocksLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbDmlLocksLimit.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbDmlLocksUsageDataPoint adds a data point to oracledb.dml_locks.usage metric. -func (mb *MetricsBuilder) RecordOracledbDmlLocksUsageDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbDmlLocksUsageDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbDmlLocksUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbDmlLocksUsage.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbEnqueueDeadlocksDataPoint adds a data point to oracledb.enqueue_deadlocks metric. -func (mb *MetricsBuilder) RecordOracledbEnqueueDeadlocksDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbEnqueueDeadlocksDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbEnqueueDeadlocks, value was %s: %w", inputVal, err) + } mb.metricOracledbEnqueueDeadlocks.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbEnqueueLocksLimitDataPoint adds a data point to oracledb.enqueue_locks.limit metric. -func (mb *MetricsBuilder) RecordOracledbEnqueueLocksLimitDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbEnqueueLocksLimitDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbEnqueueLocksLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbEnqueueLocksLimit.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbEnqueueLocksUsageDataPoint adds a data point to oracledb.enqueue_locks.usage metric. -func (mb *MetricsBuilder) RecordOracledbEnqueueLocksUsageDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbEnqueueLocksUsageDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbEnqueueLocksUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbEnqueueLocksUsage.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbEnqueueResourcesLimitDataPoint adds a data point to oracledb.enqueue_resources.limit metric. -func (mb *MetricsBuilder) RecordOracledbEnqueueResourcesLimitDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbEnqueueResourcesLimitDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbEnqueueResourcesLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbEnqueueResourcesLimit.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbEnqueueResourcesUsageDataPoint adds a data point to oracledb.enqueue_resources.usage metric. -func (mb *MetricsBuilder) RecordOracledbEnqueueResourcesUsageDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbEnqueueResourcesUsageDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbEnqueueResourcesUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbEnqueueResourcesUsage.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbExchangeDeadlocksDataPoint adds a data point to oracledb.exchange_deadlocks metric. -func (mb *MetricsBuilder) RecordOracledbExchangeDeadlocksDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbExchangeDeadlocksDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbExchangeDeadlocks, value was %s: %w", inputVal, err) + } mb.metricOracledbExchangeDeadlocks.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbExecutionsDataPoint adds a data point to oracledb.executions metric. -func (mb *MetricsBuilder) RecordOracledbExecutionsDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbExecutionsDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbExecutions, value was %s: %w", inputVal, err) + } mb.metricOracledbExecutions.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbHardParsesDataPoint adds a data point to oracledb.hard_parses metric. -func (mb *MetricsBuilder) RecordOracledbHardParsesDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbHardParsesDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbHardParses, value was %s: %w", inputVal, err) + } mb.metricOracledbHardParses.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbLogicalReadsDataPoint adds a data point to oracledb.logical_reads metric. -func (mb *MetricsBuilder) RecordOracledbLogicalReadsDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbLogicalReadsDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbLogicalReads, value was %s: %w", inputVal, err) + } mb.metricOracledbLogicalReads.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbParseCallsDataPoint adds a data point to oracledb.parse_calls metric. -func (mb *MetricsBuilder) RecordOracledbParseCallsDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbParseCallsDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbParseCalls, value was %s: %w", inputVal, err) + } mb.metricOracledbParseCalls.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbPgaMemoryDataPoint adds a data point to oracledb.pga_memory metric. -func (mb *MetricsBuilder) RecordOracledbPgaMemoryDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbPgaMemoryDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbPgaMemory, value was %s: %w", inputVal, err) + } mb.metricOracledbPgaMemory.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbPhysicalReadsDataPoint adds a data point to oracledb.physical_reads metric. -func (mb *MetricsBuilder) RecordOracledbPhysicalReadsDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbPhysicalReadsDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbPhysicalReads, value was %s: %w", inputVal, err) + } mb.metricOracledbPhysicalReads.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbProcessesLimitDataPoint adds a data point to oracledb.processes.limit metric. -func (mb *MetricsBuilder) RecordOracledbProcessesLimitDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbProcessesLimitDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbProcessesLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbProcessesLimit.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbProcessesUsageDataPoint adds a data point to oracledb.processes.usage metric. -func (mb *MetricsBuilder) RecordOracledbProcessesUsageDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbProcessesUsageDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbProcessesUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbProcessesUsage.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbSessionsLimitDataPoint adds a data point to oracledb.sessions.limit metric. -func (mb *MetricsBuilder) RecordOracledbSessionsLimitDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbSessionsLimitDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbSessionsLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbSessionsLimit.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbSessionsUsageDataPoint adds a data point to oracledb.sessions.usage metric. -func (mb *MetricsBuilder) RecordOracledbSessionsUsageDataPoint(ts pcommon.Timestamp, val int64, sessionTypeAttributeValue string, sessionStatusAttributeValue string) { +func (mb *MetricsBuilder) RecordOracledbSessionsUsageDataPoint(ts pcommon.Timestamp, inputVal string, sessionTypeAttributeValue string, sessionStatusAttributeValue string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbSessionsUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbSessionsUsage.recordDataPoint(mb.startTime, ts, val, sessionTypeAttributeValue, sessionStatusAttributeValue) + return nil } // RecordOracledbTablespaceSizeLimitDataPoint adds a data point to oracledb.tablespace_size.limit metric. -func (mb *MetricsBuilder) RecordOracledbTablespaceSizeLimitDataPoint(ts pcommon.Timestamp, val int64, tablespaceNameAttributeValue string) { +func (mb *MetricsBuilder) RecordOracledbTablespaceSizeLimitDataPoint(ts pcommon.Timestamp, inputVal string, tablespaceNameAttributeValue string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbTablespaceSizeLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbTablespaceSizeLimit.recordDataPoint(mb.startTime, ts, val, tablespaceNameAttributeValue) + return nil } // RecordOracledbTablespaceSizeUsageDataPoint adds a data point to oracledb.tablespace_size.usage metric. -func (mb *MetricsBuilder) RecordOracledbTablespaceSizeUsageDataPoint(ts pcommon.Timestamp, val int64, tablespaceNameAttributeValue string) { +func (mb *MetricsBuilder) RecordOracledbTablespaceSizeUsageDataPoint(ts pcommon.Timestamp, inputVal string, tablespaceNameAttributeValue string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbTablespaceSizeUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbTablespaceSizeUsage.recordDataPoint(mb.startTime, ts, val, tablespaceNameAttributeValue) + return nil } // RecordOracledbTransactionsLimitDataPoint adds a data point to oracledb.transactions.limit metric. -func (mb *MetricsBuilder) RecordOracledbTransactionsLimitDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbTransactionsLimitDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbTransactionsLimit, value was %s: %w", inputVal, err) + } mb.metricOracledbTransactionsLimit.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbTransactionsUsageDataPoint adds a data point to oracledb.transactions.usage metric. -func (mb *MetricsBuilder) RecordOracledbTransactionsUsageDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbTransactionsUsageDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbTransactionsUsage, value was %s: %w", inputVal, err) + } mb.metricOracledbTransactionsUsage.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbUserCommitsDataPoint adds a data point to oracledb.user_commits metric. -func (mb *MetricsBuilder) RecordOracledbUserCommitsDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbUserCommitsDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbUserCommits, value was %s: %w", inputVal, err) + } mb.metricOracledbUserCommits.recordDataPoint(mb.startTime, ts, val) + return nil } // RecordOracledbUserRollbacksDataPoint adds a data point to oracledb.user_rollbacks metric. -func (mb *MetricsBuilder) RecordOracledbUserRollbacksDataPoint(ts pcommon.Timestamp, val int64) { +func (mb *MetricsBuilder) RecordOracledbUserRollbacksDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for OracledbUserRollbacks, value was %s: %w", inputVal, err) + } mb.metricOracledbUserRollbacks.recordDataPoint(mb.startTime, ts, val) + return nil } // Reset resets metrics builder to its initial state. It should be used when external metrics source is restarted, diff --git a/receiver/oracledbreceiver/internal/metadata/generated_metrics_test.go b/receiver/oracledbreceiver/internal/metadata/generated_metrics_test.go index 42bbfd8a985c..791df4b0ac7a 100644 --- a/receiver/oracledbreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/oracledbreceiver/internal/metadata/generated_metrics_test.go @@ -24,76 +24,76 @@ func TestDefaultMetrics(t *testing.T) { mb.RecordOracledbCPUTimeDataPoint(ts, 1) enabledMetrics["oracledb.dml_locks.limit"] = true - mb.RecordOracledbDmlLocksLimitDataPoint(ts, 1) + mb.RecordOracledbDmlLocksLimitDataPoint(ts, "1") enabledMetrics["oracledb.dml_locks.usage"] = true - mb.RecordOracledbDmlLocksUsageDataPoint(ts, 1) + mb.RecordOracledbDmlLocksUsageDataPoint(ts, "1") enabledMetrics["oracledb.enqueue_deadlocks"] = true - mb.RecordOracledbEnqueueDeadlocksDataPoint(ts, 1) + mb.RecordOracledbEnqueueDeadlocksDataPoint(ts, "1") enabledMetrics["oracledb.enqueue_locks.limit"] = true - mb.RecordOracledbEnqueueLocksLimitDataPoint(ts, 1) + mb.RecordOracledbEnqueueLocksLimitDataPoint(ts, "1") enabledMetrics["oracledb.enqueue_locks.usage"] = true - mb.RecordOracledbEnqueueLocksUsageDataPoint(ts, 1) + mb.RecordOracledbEnqueueLocksUsageDataPoint(ts, "1") enabledMetrics["oracledb.enqueue_resources.limit"] = true - mb.RecordOracledbEnqueueResourcesLimitDataPoint(ts, 1) + mb.RecordOracledbEnqueueResourcesLimitDataPoint(ts, "1") enabledMetrics["oracledb.enqueue_resources.usage"] = true - mb.RecordOracledbEnqueueResourcesUsageDataPoint(ts, 1) + mb.RecordOracledbEnqueueResourcesUsageDataPoint(ts, "1") enabledMetrics["oracledb.exchange_deadlocks"] = true - mb.RecordOracledbExchangeDeadlocksDataPoint(ts, 1) + mb.RecordOracledbExchangeDeadlocksDataPoint(ts, "1") enabledMetrics["oracledb.executions"] = true - mb.RecordOracledbExecutionsDataPoint(ts, 1) + mb.RecordOracledbExecutionsDataPoint(ts, "1") enabledMetrics["oracledb.hard_parses"] = true - mb.RecordOracledbHardParsesDataPoint(ts, 1) + mb.RecordOracledbHardParsesDataPoint(ts, "1") enabledMetrics["oracledb.logical_reads"] = true - mb.RecordOracledbLogicalReadsDataPoint(ts, 1) + mb.RecordOracledbLogicalReadsDataPoint(ts, "1") enabledMetrics["oracledb.parse_calls"] = true - mb.RecordOracledbParseCallsDataPoint(ts, 1) + mb.RecordOracledbParseCallsDataPoint(ts, "1") enabledMetrics["oracledb.pga_memory"] = true - mb.RecordOracledbPgaMemoryDataPoint(ts, 1) + mb.RecordOracledbPgaMemoryDataPoint(ts, "1") enabledMetrics["oracledb.physical_reads"] = true - mb.RecordOracledbPhysicalReadsDataPoint(ts, 1) + mb.RecordOracledbPhysicalReadsDataPoint(ts, "1") enabledMetrics["oracledb.processes.limit"] = true - mb.RecordOracledbProcessesLimitDataPoint(ts, 1) + mb.RecordOracledbProcessesLimitDataPoint(ts, "1") enabledMetrics["oracledb.processes.usage"] = true - mb.RecordOracledbProcessesUsageDataPoint(ts, 1) + mb.RecordOracledbProcessesUsageDataPoint(ts, "1") enabledMetrics["oracledb.sessions.limit"] = true - mb.RecordOracledbSessionsLimitDataPoint(ts, 1) + mb.RecordOracledbSessionsLimitDataPoint(ts, "1") enabledMetrics["oracledb.sessions.usage"] = true - mb.RecordOracledbSessionsUsageDataPoint(ts, 1, "attr-val", "attr-val") + mb.RecordOracledbSessionsUsageDataPoint(ts, "1", "attr-val", "attr-val") enabledMetrics["oracledb.tablespace_size.limit"] = true - mb.RecordOracledbTablespaceSizeLimitDataPoint(ts, 1, "attr-val") + mb.RecordOracledbTablespaceSizeLimitDataPoint(ts, "1", "attr-val") enabledMetrics["oracledb.tablespace_size.usage"] = true - mb.RecordOracledbTablespaceSizeUsageDataPoint(ts, 1, "attr-val") + mb.RecordOracledbTablespaceSizeUsageDataPoint(ts, "1", "attr-val") enabledMetrics["oracledb.transactions.limit"] = true - mb.RecordOracledbTransactionsLimitDataPoint(ts, 1) + mb.RecordOracledbTransactionsLimitDataPoint(ts, "1") enabledMetrics["oracledb.transactions.usage"] = true - mb.RecordOracledbTransactionsUsageDataPoint(ts, 1) + mb.RecordOracledbTransactionsUsageDataPoint(ts, "1") enabledMetrics["oracledb.user_commits"] = true - mb.RecordOracledbUserCommitsDataPoint(ts, 1) + mb.RecordOracledbUserCommitsDataPoint(ts, "1") enabledMetrics["oracledb.user_rollbacks"] = true - mb.RecordOracledbUserRollbacksDataPoint(ts, 1) + mb.RecordOracledbUserRollbacksDataPoint(ts, "1") metrics := mb.Emit() @@ -148,30 +148,30 @@ func TestAllMetrics(t *testing.T) { assert.Equal(t, 0, observedLogs.Len()) mb.RecordOracledbCPUTimeDataPoint(ts, 1) - mb.RecordOracledbDmlLocksLimitDataPoint(ts, 1) - mb.RecordOracledbDmlLocksUsageDataPoint(ts, 1) - mb.RecordOracledbEnqueueDeadlocksDataPoint(ts, 1) - mb.RecordOracledbEnqueueLocksLimitDataPoint(ts, 1) - mb.RecordOracledbEnqueueLocksUsageDataPoint(ts, 1) - mb.RecordOracledbEnqueueResourcesLimitDataPoint(ts, 1) - mb.RecordOracledbEnqueueResourcesUsageDataPoint(ts, 1) - mb.RecordOracledbExchangeDeadlocksDataPoint(ts, 1) - mb.RecordOracledbExecutionsDataPoint(ts, 1) - mb.RecordOracledbHardParsesDataPoint(ts, 1) - mb.RecordOracledbLogicalReadsDataPoint(ts, 1) - mb.RecordOracledbParseCallsDataPoint(ts, 1) - mb.RecordOracledbPgaMemoryDataPoint(ts, 1) - mb.RecordOracledbPhysicalReadsDataPoint(ts, 1) - mb.RecordOracledbProcessesLimitDataPoint(ts, 1) - mb.RecordOracledbProcessesUsageDataPoint(ts, 1) - mb.RecordOracledbSessionsLimitDataPoint(ts, 1) - mb.RecordOracledbSessionsUsageDataPoint(ts, 1, "attr-val", "attr-val") - mb.RecordOracledbTablespaceSizeLimitDataPoint(ts, 1, "attr-val") - mb.RecordOracledbTablespaceSizeUsageDataPoint(ts, 1, "attr-val") - mb.RecordOracledbTransactionsLimitDataPoint(ts, 1) - mb.RecordOracledbTransactionsUsageDataPoint(ts, 1) - mb.RecordOracledbUserCommitsDataPoint(ts, 1) - mb.RecordOracledbUserRollbacksDataPoint(ts, 1) + mb.RecordOracledbDmlLocksLimitDataPoint(ts, "1") + mb.RecordOracledbDmlLocksUsageDataPoint(ts, "1") + mb.RecordOracledbEnqueueDeadlocksDataPoint(ts, "1") + mb.RecordOracledbEnqueueLocksLimitDataPoint(ts, "1") + mb.RecordOracledbEnqueueLocksUsageDataPoint(ts, "1") + mb.RecordOracledbEnqueueResourcesLimitDataPoint(ts, "1") + mb.RecordOracledbEnqueueResourcesUsageDataPoint(ts, "1") + mb.RecordOracledbExchangeDeadlocksDataPoint(ts, "1") + mb.RecordOracledbExecutionsDataPoint(ts, "1") + mb.RecordOracledbHardParsesDataPoint(ts, "1") + mb.RecordOracledbLogicalReadsDataPoint(ts, "1") + mb.RecordOracledbParseCallsDataPoint(ts, "1") + mb.RecordOracledbPgaMemoryDataPoint(ts, "1") + mb.RecordOracledbPhysicalReadsDataPoint(ts, "1") + mb.RecordOracledbProcessesLimitDataPoint(ts, "1") + mb.RecordOracledbProcessesUsageDataPoint(ts, "1") + mb.RecordOracledbSessionsLimitDataPoint(ts, "1") + mb.RecordOracledbSessionsUsageDataPoint(ts, "1", "attr-val", "attr-val") + mb.RecordOracledbTablespaceSizeLimitDataPoint(ts, "1", "attr-val") + mb.RecordOracledbTablespaceSizeUsageDataPoint(ts, "1", "attr-val") + mb.RecordOracledbTransactionsLimitDataPoint(ts, "1") + mb.RecordOracledbTransactionsUsageDataPoint(ts, "1") + mb.RecordOracledbUserCommitsDataPoint(ts, "1") + mb.RecordOracledbUserRollbacksDataPoint(ts, "1") metrics := mb.Emit(WithOracledbInstanceName("attr-val")) @@ -542,30 +542,30 @@ func TestNoMetrics(t *testing.T) { assert.Equal(t, 0, observedLogs.Len()) mb.RecordOracledbCPUTimeDataPoint(ts, 1) - mb.RecordOracledbDmlLocksLimitDataPoint(ts, 1) - mb.RecordOracledbDmlLocksUsageDataPoint(ts, 1) - mb.RecordOracledbEnqueueDeadlocksDataPoint(ts, 1) - mb.RecordOracledbEnqueueLocksLimitDataPoint(ts, 1) - mb.RecordOracledbEnqueueLocksUsageDataPoint(ts, 1) - mb.RecordOracledbEnqueueResourcesLimitDataPoint(ts, 1) - mb.RecordOracledbEnqueueResourcesUsageDataPoint(ts, 1) - mb.RecordOracledbExchangeDeadlocksDataPoint(ts, 1) - mb.RecordOracledbExecutionsDataPoint(ts, 1) - mb.RecordOracledbHardParsesDataPoint(ts, 1) - mb.RecordOracledbLogicalReadsDataPoint(ts, 1) - mb.RecordOracledbParseCallsDataPoint(ts, 1) - mb.RecordOracledbPgaMemoryDataPoint(ts, 1) - mb.RecordOracledbPhysicalReadsDataPoint(ts, 1) - mb.RecordOracledbProcessesLimitDataPoint(ts, 1) - mb.RecordOracledbProcessesUsageDataPoint(ts, 1) - mb.RecordOracledbSessionsLimitDataPoint(ts, 1) - mb.RecordOracledbSessionsUsageDataPoint(ts, 1, "attr-val", "attr-val") - mb.RecordOracledbTablespaceSizeLimitDataPoint(ts, 1, "attr-val") - mb.RecordOracledbTablespaceSizeUsageDataPoint(ts, 1, "attr-val") - mb.RecordOracledbTransactionsLimitDataPoint(ts, 1) - mb.RecordOracledbTransactionsUsageDataPoint(ts, 1) - mb.RecordOracledbUserCommitsDataPoint(ts, 1) - mb.RecordOracledbUserRollbacksDataPoint(ts, 1) + mb.RecordOracledbDmlLocksLimitDataPoint(ts, "1") + mb.RecordOracledbDmlLocksUsageDataPoint(ts, "1") + mb.RecordOracledbEnqueueDeadlocksDataPoint(ts, "1") + mb.RecordOracledbEnqueueLocksLimitDataPoint(ts, "1") + mb.RecordOracledbEnqueueLocksUsageDataPoint(ts, "1") + mb.RecordOracledbEnqueueResourcesLimitDataPoint(ts, "1") + mb.RecordOracledbEnqueueResourcesUsageDataPoint(ts, "1") + mb.RecordOracledbExchangeDeadlocksDataPoint(ts, "1") + mb.RecordOracledbExecutionsDataPoint(ts, "1") + mb.RecordOracledbHardParsesDataPoint(ts, "1") + mb.RecordOracledbLogicalReadsDataPoint(ts, "1") + mb.RecordOracledbParseCallsDataPoint(ts, "1") + mb.RecordOracledbPgaMemoryDataPoint(ts, "1") + mb.RecordOracledbPhysicalReadsDataPoint(ts, "1") + mb.RecordOracledbProcessesLimitDataPoint(ts, "1") + mb.RecordOracledbProcessesUsageDataPoint(ts, "1") + mb.RecordOracledbSessionsLimitDataPoint(ts, "1") + mb.RecordOracledbSessionsUsageDataPoint(ts, "1", "attr-val", "attr-val") + mb.RecordOracledbTablespaceSizeLimitDataPoint(ts, "1", "attr-val") + mb.RecordOracledbTablespaceSizeUsageDataPoint(ts, "1", "attr-val") + mb.RecordOracledbTransactionsLimitDataPoint(ts, "1") + mb.RecordOracledbTransactionsUsageDataPoint(ts, "1") + mb.RecordOracledbUserCommitsDataPoint(ts, "1") + mb.RecordOracledbUserRollbacksDataPoint(ts, "1") metrics := mb.Emit() diff --git a/receiver/oracledbreceiver/metadata.yaml b/receiver/oracledbreceiver/metadata.yaml index 8f59d6b201eb..05effb312f33 100644 --- a/receiver/oracledbreceiver/metadata.yaml +++ b/receiver/oracledbreceiver/metadata.yaml @@ -33,6 +33,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{deadlocks}" oracledb.exchange_deadlocks: description: Number of times that a process detected a potential deadlock when @@ -43,6 +44,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{deadlocks}" oracledb.executions: description: Total number of calls (user and recursive) that executed SQL statements @@ -51,6 +53,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{executions}" oracledb.logical_reads: description: Number of logical reads @@ -59,6 +62,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{reads}" oracledb.hard_parses: description: Number of hard parses @@ -67,6 +71,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{parses}" oracledb.parse_calls: description: Total number of parse calls. @@ -75,6 +80,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{parses}" oracledb.pga_memory: description: Session PGA (Program Global Area) memory @@ -83,6 +89,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: By oracledb.physical_reads: description: Number of physical reads @@ -91,6 +98,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{reads}" oracledb.user_commits: description: Number of user commits. When a user commits a transaction, the redo @@ -101,6 +109,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: "{commits}" oracledb.user_rollbacks: description: Number of times users manually issue the ROLLBACK statement or an @@ -110,6 +119,7 @@ metrics: aggregation: cumulative monotonic: true value_type: int + input_type: string unit: 1 oracledb.sessions.usage: attributes: @@ -119,72 +129,84 @@ metrics: enabled: true gauge: value_type: int + input_type: string unit: "{sessions}" oracledb.processes.usage: description: Current count of active processes. enabled: true gauge: value_type: int + input_type: string unit: "{processes}" oracledb.processes.limit: description: Maximum limit of active processes. enabled: true gauge: value_type: int + input_type: string unit: "{processes}" oracledb.sessions.limit: description: Maximum limit of active sessions. enabled: true gauge: value_type: int + input_type: string unit: "{sessions}" oracledb.enqueue_locks.usage: description: Current count of active enqueue locks. enabled: true gauge: value_type: int + input_type: string unit: "{locks}" oracledb.enqueue_locks.limit: description: Maximum limit of active enqueue locks. enabled: true gauge: value_type: int + input_type: string unit: "{locks}" oracledb.dml_locks.usage: description: Current count of active DML (Data Manipulation Language) locks. enabled: true gauge: value_type: int + input_type: string unit: "{locks}" oracledb.dml_locks.limit: description: Maximum limit of active DML (Data Manipulation Language) locks. enabled: true gauge: value_type: int + input_type: string unit: "{locks}" oracledb.enqueue_resources.usage: description: Current count of active enqueue resources. enabled: true gauge: value_type: int + input_type: string unit: "{resources}" oracledb.enqueue_resources.limit: description: Maximum limit of active enqueue resources. enabled: true gauge: value_type: int + input_type: string unit: "{resources}" oracledb.transactions.usage: description: Current count of active transactions. enabled: true gauge: value_type: int + input_type: string unit: "{transactions}" oracledb.transactions.limit: description: Maximum limit of active transactions. enabled: true gauge: value_type: int + input_type: string unit: "{transactions}" oracledb.tablespace_size.limit: attributes: @@ -193,6 +215,7 @@ metrics: enabled: true gauge: value_type: int + input_type: string unit: By oracledb.tablespace_size.usage: attributes: @@ -201,4 +224,5 @@ metrics: enabled: true gauge: value_type: int + input_type: string unit: By diff --git a/receiver/oracledbreceiver/scraper.go b/receiver/oracledbreceiver/scraper.go new file mode 100644 index 000000000000..f1ecf36b7925 --- /dev/null +++ b/receiver/oracledbreceiver/scraper.go @@ -0,0 +1,293 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver" + +import ( + "context" + "database/sql" + "fmt" + "strconv" + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver/scrapererror" + "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.uber.org/multierr" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver/internal/metadata" +) + +const ( + statsSQL = "select * from v$sysstat" + enqueueDeadlocks = "enqueue deadlocks" + exchangeDeadlocks = "exchange deadlocks" + executeCount = "execute count" + parseCountTotal = "parse count (total)" + parseCountHard = "parse count (hard)" + userCommits = "user commits" + userRollbacks = "user rollbacks" + physicalReads = "physical reads" + sessionLogicalReads = "session logical reads" + cpuTime = "CPU used by this session" + pgaMemory = "session pga memory" + sessionCountSQL = "select status, type, count(*) as VALUE FROM v$session GROUP BY status, type" + systemResourceLimitsSQL = "select RESOURCE_NAME, CURRENT_UTILIZATION, LIMIT_VALUE, CASE WHEN TRIM(INITIAL_ALLOCATION) LIKE 'UNLIMITED' THEN '-1' ELSE TRIM(INITIAL_ALLOCATION) END as INITIAL_ALLOCATION, CASE WHEN TRIM(LIMIT_VALUE) LIKE 'UNLIMITED' THEN '-1' ELSE TRIM(LIMIT_VALUE) END as LIMIT_VALUE from v$resource_limit" + tablespaceUsageSQL = "select TABLESPACE_NAME, BYTES from DBA_DATA_FILES" + tablespaceMaxSpaceSQL = "select TABLESPACE_NAME, (BLOCK_SIZE*MAX_EXTENTS) AS VALUE FROM DBA_TABLESPACES" +) + +type dbProviderFunc func() (*sql.DB, error) + +type clientProviderFunc func(*sql.DB, string, *zap.Logger) dbClient + +type scraper struct { + statsClient dbClient + tablespaceMaxSpaceClient dbClient + tablespaceUsageClient dbClient + systemResourceLimitsClient dbClient + sessionCountClient dbClient + db *sql.DB + clientProviderFunc clientProviderFunc + metricsBuilder *metadata.MetricsBuilder + dbProviderFunc dbProviderFunc + logger *zap.Logger + id component.ID + instanceName string + scrapeCfg scraperhelper.ScraperControllerSettings + startTime pcommon.Timestamp + metricsSettings metadata.MetricsSettings +} + +func newScraper(id component.ID, metricsBuilder *metadata.MetricsBuilder, metricsSettings metadata.MetricsSettings, scrapeCfg scraperhelper.ScraperControllerSettings, logger *zap.Logger, providerFunc dbProviderFunc, clientProviderFunc clientProviderFunc, instanceName string) (scraperhelper.Scraper, error) { + s := &scraper{ + metricsBuilder: metricsBuilder, + metricsSettings: metricsSettings, + scrapeCfg: scrapeCfg, + logger: logger, + dbProviderFunc: providerFunc, + clientProviderFunc: clientProviderFunc, + instanceName: instanceName, + } + return scraperhelper.NewScraper(id.String(), s.scrape, scraperhelper.WithShutdown(s.shutdown), scraperhelper.WithStart(s.start)) +} + +func (s *scraper) start(context.Context, component.Host) error { + s.startTime = pcommon.NewTimestampFromTime(time.Now()) + var err error + s.db, err = s.dbProviderFunc() + if err != nil { + return fmt.Errorf("failed to open db connection: %w", err) + } + s.statsClient = s.clientProviderFunc(s.db, statsSQL, s.logger) + s.sessionCountClient = s.clientProviderFunc(s.db, sessionCountSQL, s.logger) + s.systemResourceLimitsClient = s.clientProviderFunc(s.db, systemResourceLimitsSQL, s.logger) + s.tablespaceUsageClient = s.clientProviderFunc(s.db, tablespaceUsageSQL, s.logger) + s.tablespaceMaxSpaceClient = s.clientProviderFunc(s.db, tablespaceMaxSpaceSQL, s.logger) + return nil +} + +func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { + s.logger.Debug("Begin scrape") + + var scrapeErrors []error + + runStats := s.metricsSettings.OracledbEnqueueDeadlocks.Enabled || s.metricsSettings.OracledbExchangeDeadlocks.Enabled || s.metricsSettings.OracledbExecutions.Enabled || s.metricsSettings.OracledbParseCalls.Enabled || s.metricsSettings.OracledbHardParses.Enabled || s.metricsSettings.OracledbUserCommits.Enabled || s.metricsSettings.OracledbUserRollbacks.Enabled || s.metricsSettings.OracledbPhysicalReads.Enabled || s.metricsSettings.OracledbLogicalReads.Enabled || s.metricsSettings.OracledbCPUTime.Enabled || s.metricsSettings.OracledbPgaMemory.Enabled + if runStats { + now := pcommon.NewTimestampFromTime(time.Now()) + rows, execError := s.statsClient.metricRows(ctx) + if execError != nil { + scrapeErrors = append(scrapeErrors, fmt.Errorf("error executing %s: %w", statsSQL, execError)) + } + + for _, row := range rows { + switch row["NAME"] { + case enqueueDeadlocks: + err := s.metricsBuilder.RecordOracledbEnqueueDeadlocksDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case exchangeDeadlocks: + err := s.metricsBuilder.RecordOracledbExchangeDeadlocksDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case executeCount: + err := s.metricsBuilder.RecordOracledbExecutionsDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case parseCountTotal: + err := s.metricsBuilder.RecordOracledbParseCallsDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case parseCountHard: + err := s.metricsBuilder.RecordOracledbHardParsesDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case userCommits: + err := s.metricsBuilder.RecordOracledbUserCommitsDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case userRollbacks: + err := s.metricsBuilder.RecordOracledbUserRollbacksDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case physicalReads: + err := s.metricsBuilder.RecordOracledbPhysicalReadsDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case sessionLogicalReads: + err := s.metricsBuilder.RecordOracledbLogicalReadsDataPoint(now, row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case cpuTime: + value, err := strconv.ParseFloat(row["VALUE"], 64) + if err != nil { + scrapeErrors = append(scrapeErrors, fmt.Errorf("%s value: %q, %w", cpuTime, row["VALUE"], err)) + } else { + // divide by 100 as the value is expressed in tens of milliseconds + value /= 100 + s.metricsBuilder.RecordOracledbCPUTimeDataPoint(now, value) + } + case pgaMemory: + err := s.metricsBuilder.RecordOracledbPgaMemoryDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + } + } + } + + if s.metricsSettings.OracledbSessionsUsage.Enabled { + rows, err := s.sessionCountClient.metricRows(ctx) + if err != nil { + scrapeErrors = append(scrapeErrors, fmt.Errorf("error executing %s: %w", sessionCountSQL, err)) + } + for _, row := range rows { + err := s.metricsBuilder.RecordOracledbSessionsUsageDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["VALUE"], row["TYPE"], row["STATUS"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + } + } + + if s.metricsSettings.OracledbSessionsLimit.Enabled || + s.metricsSettings.OracledbProcessesUsage.Enabled || s.metricsSettings.OracledbProcessesLimit.Enabled || + s.metricsSettings.OracledbEnqueueResourcesUsage.Enabled || s.metricsSettings.OracledbEnqueueResourcesLimit.Enabled || + s.metricsSettings.OracledbEnqueueLocksLimit.Enabled || s.metricsSettings.OracledbEnqueueLocksUsage.Enabled { + rows, err := s.systemResourceLimitsClient.metricRows(ctx) + if err != nil { + scrapeErrors = append(scrapeErrors, fmt.Errorf("error executing %s: %w", systemResourceLimitsSQL, err)) + } + for _, row := range rows { + resourceName := row["RESOURCE_NAME"] + switch resourceName { + case "processes": + if err := s.metricsBuilder.RecordOracledbProcessesUsageDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["CURRENT_UTILIZATION"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + if err := s.metricsBuilder.RecordOracledbProcessesLimitDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["LIMIT_VALUE"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case "sessions": + err := s.metricsBuilder.RecordOracledbSessionsLimitDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["LIMIT_VALUE"]) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case "enqueue_locks": + if err := s.metricsBuilder.RecordOracledbEnqueueLocksUsageDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["CURRENT_UTILIZATION"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + if err := s.metricsBuilder.RecordOracledbEnqueueLocksLimitDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["LIMIT_VALUE"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case "dml_locks": + if err := s.metricsBuilder.RecordOracledbDmlLocksUsageDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["CURRENT_UTILIZATION"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + if err := s.metricsBuilder.RecordOracledbDmlLocksLimitDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["LIMIT_VALUE"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case "enqueue_resources": + if err := s.metricsBuilder.RecordOracledbEnqueueResourcesUsageDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["CURRENT_UTILIZATION"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + if err := s.metricsBuilder.RecordOracledbEnqueueResourcesLimitDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["LIMIT_VALUE"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + case "transactions": + if err := s.metricsBuilder.RecordOracledbTransactionsUsageDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["CURRENT_UTILIZATION"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + if err := s.metricsBuilder.RecordOracledbTransactionsLimitDataPoint(pcommon.NewTimestampFromTime(time.Now()), row["LIMIT_VALUE"]); err != nil { + scrapeErrors = append(scrapeErrors, err) + } + } + } + } + if s.metricsSettings.OracledbTablespaceSizeUsage.Enabled { + rows, err := s.tablespaceUsageClient.metricRows(ctx) + if err != nil { + scrapeErrors = append(scrapeErrors, fmt.Errorf("error executing %s: %w", tablespaceUsageSQL, err)) + } else { + now := pcommon.NewTimestampFromTime(time.Now()) + for _, row := range rows { + tablespaceName := row["TABLESPACE_NAME"] + err := s.metricsBuilder.RecordOracledbTablespaceSizeUsageDataPoint(now, row["BYTES"], tablespaceName) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + } + } + } + if s.metricsSettings.OracledbTablespaceSizeLimit.Enabled { + rows, err := s.tablespaceMaxSpaceClient.metricRows(ctx) + if err != nil { + scrapeErrors = append(scrapeErrors, fmt.Errorf("error executing %s: %w", tablespaceMaxSpaceSQL, err)) + } else { + now := pcommon.NewTimestampFromTime(time.Now()) + for _, row := range rows { + tablespaceName := row["TABLESPACE_NAME"] + err := s.metricsBuilder.RecordOracledbTablespaceSizeLimitDataPoint(now, row["VALUE"], tablespaceName) + if err != nil { + scrapeErrors = append(scrapeErrors, err) + } + } + } + } + + out := s.metricsBuilder.Emit(metadata.WithOracledbInstanceName(s.instanceName)) + s.logger.Debug("Done scraping") + if len(scrapeErrors) > 0 { + return out, scrapererror.NewPartialScrapeError(multierr.Combine(scrapeErrors...), len(scrapeErrors)) + } + return out, nil +} + +func (s *scraper) shutdown(ctx context.Context) error { + if s.db == nil { + return nil + } + return s.db.Close() +} diff --git a/receiver/oracledbreceiver/scraper_test.go b/receiver/oracledbreceiver/scraper_test.go new file mode 100644 index 000000000000..18560dfaf7a8 --- /dev/null +++ b/receiver/oracledbreceiver/scraper_test.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oracledbreceiver + +import ( + "context" + "database/sql" + "errors" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/receiver/scrapererror" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver/internal/metadata" +) + +func TestScraper_ErrorOnStart(t *testing.T) { + scrpr := scraper{ + dbProviderFunc: func() (*sql.DB, error) { + return nil, errors.New("oops") + }, + } + err := scrpr.start(context.Background(), componenttest.NewNopHost()) + require.Error(t, err) +} + +var queryResponses = map[string][]metricRow{ + statsSQL: {{"NAME": enqueueDeadlocks, "VALUE": "18"}, {"NAME": exchangeDeadlocks, "VALUE": "88898"}, {"NAME": executeCount, "VALUE": "178878"}, {"NAME": parseCountTotal, "VALUE": "1999"}, {"NAME": parseCountHard, "VALUE": "1"}, {"NAME": userCommits, "VALUE": "187778888"}, {"NAME": userRollbacks, "VALUE": "1898979879789"}, {"NAME": physicalReads, "VALUE": "1887777"}, {"NAME": sessionLogicalReads, "VALUE": "189"}, {"NAME": cpuTime, "VALUE": "1887"}, {"NAME": pgaMemory, "VALUE": "1999887"}}, + sessionCountSQL: {{"VALUE": "1"}}, + systemResourceLimitsSQL: {{"RESOURCE_NAME": "processes", "CURRENT_UTILIZATION": "3", "MAX_UTILIZATION": "10", "INITIAL_ALLOCATION": "100", "LIMIT_VALUE": "100"}, + {"RESOURCE_NAME": "locks", "CURRENT_UTILIZATION": "3", "MAX_UTILIZATION": "10", "INITIAL_ALLOCATION": "-1", "LIMIT_VALUE": "-1"}}, + tablespaceUsageSQL: {{"TABLESPACE_NAME": "SYS", "BYTES": "1024"}}, + tablespaceMaxSpaceSQL: {{"TABLESPACE_NAME": "SYS", "VALUE": "1024"}}, +} + +func TestScraper_Scrape(t *testing.T) { + metricsBuilder := metadata.NewMetricsBuilder(metadata.DefaultMetricsSettings(), componenttest.NewNopReceiverCreateSettings()) + + scrpr := scraper{ + logger: zap.NewNop(), + metricsBuilder: metricsBuilder, + dbProviderFunc: func() (*sql.DB, error) { + return nil, nil + }, + clientProviderFunc: func(db *sql.DB, s string, logger *zap.Logger) dbClient { + return &fakeDbClient{ + Responses: [][]metricRow{ + queryResponses[s], + }, + } + }, + id: component.ID{}, + metricsSettings: metadata.DefaultMetricsSettings(), + } + err := scrpr.start(context.Background(), componenttest.NewNopHost()) + defer func() { + assert.NoError(t, scrpr.shutdown(context.Background())) + }() + require.NoError(t, err) + m, err := scrpr.scrape(context.Background()) + require.NoError(t, err) + assert.Equal(t, 16, m.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().Len()) +} + +func TestPartial_InvalidScrape(t *testing.T) { + metricsBuilder := metadata.NewMetricsBuilder(metadata.DefaultMetricsSettings(), componenttest.NewNopReceiverCreateSettings()) + + scrpr := scraper{ + logger: zap.NewNop(), + metricsBuilder: metricsBuilder, + dbProviderFunc: func() (*sql.DB, error) { + return nil, nil + }, + clientProviderFunc: func(db *sql.DB, s string, logger *zap.Logger) dbClient { + if s == tablespaceUsageSQL { + return &fakeDbClient{Responses: [][]metricRow{ + { + {}, + }, + }} + } + return &fakeDbClient{Responses: [][]metricRow{ + queryResponses[s], + }} + }, + id: component.ID{}, + metricsSettings: metadata.DefaultMetricsSettings(), + } + err := scrpr.start(context.Background(), componenttest.NewNopHost()) + defer func() { + assert.NoError(t, scrpr.shutdown(context.Background())) + }() + require.NoError(t, err) + _, err = scrpr.scrape(context.Background()) + require.Error(t, err) + require.True(t, scrapererror.IsPartialScrapeError(err)) + require.EqualError(t, err, `failed to parse int64 for OracledbTablespaceSizeUsage, value was : strconv.ParseInt: parsing "": invalid syntax`) +} diff --git a/receiver/oracledbreceiver/testdata/config.yaml b/receiver/oracledbreceiver/testdata/config.yaml new file mode 100644 index 000000000000..6b35608a4af8 --- /dev/null +++ b/receiver/oracledbreceiver/testdata/config.yaml @@ -0,0 +1,14 @@ +oracledb: + # driver name: oracle + # username: otel + # password: password + # host: localhost + # container exposed port: 51521 + # Oracle DB service name: XE + # Refer to Oracle Go Driver go_ora documentation for full connection string options + datasource: "oracle://otel:password@localhost:51521/XE" + metrics: + oracledb.exchange_deadlocks: + enabled: false + oracledb.tablespace_size.usage: + enabled: false \ No newline at end of file