Skip to content

Commit

Permalink
[receiver/oracledbreceiver] New oracle DB receiver (#14316)
Browse files Browse the repository at this point in the history
Skeleton for the new Oracle DB receiver component 

Co-authored-by: Dmitrii Anoshin <[email protected]>
  • Loading branch information
atoulme and dmitryax authored Oct 1, 2022
1 parent 441ac27 commit 3a59b75
Show file tree
Hide file tree
Showing 15 changed files with 611 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .chloggen/add_oracledb_receiver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
change_type: new_component

component: oracledbreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add a new Oracle DB receiver component collecting metrics by periodically querying the database.

# One or more tracking issues related to the change
issues: [13939]

# (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:
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ receiver/mysqlreceiver/ @open-telemetry/collector-c
receiver/nginxreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski
receiver/nsxtreceiver/ @open-telemetry/collector-contrib-approvers @dashpole @schmikei
receiver/opencensusreceiver/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers
receiver/oracledbreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax @crobert-1 @atoulme
receiver/podmanreceiver/ @open-telemetry/collector-contrib-approvers @rogercoll
receiver/otlpjsonfilereceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @atoulme
receiver/postgresqlreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski
Expand Down
3 changes: 3 additions & 0 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver v0.61.0 //indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjsonfilereceiver v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver v0.61.0 // indirect
Expand Down Expand Up @@ -919,6 +920,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtr

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver => ../../receiver/opencensusreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver => ../../receiver/oracledbreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver => ../../receiver/podmanreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver => ../../receiver/postgresqlreceiver
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjsonfilereceiver v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver v0.61.0
Expand Down Expand Up @@ -920,6 +921,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtr

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver => ./receiver/opencensusreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver => ./receiver/oracledbreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjsonfilereceiver => ./receiver/otlpjsonfilereceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver => ./receiver/podmanreceiver
Expand Down
2 changes: 2 additions & 0 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjsonfilereceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver"
Expand Down Expand Up @@ -243,6 +244,7 @@ func Components() (component.Factories, error) {
nsxtreceiver.NewFactory(),
nginxreceiver.NewFactory(),
opencensusreceiver.NewFactory(),
oracledbreceiver.NewFactory(),
otlpjsonfilereceiver.NewFactory(),
otlpreceiver.NewFactory(),
podmanreceiver.NewFactory(),
Expand Down
3 changes: 3 additions & 0 deletions internal/components/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func TestDefaultReceivers(t *testing.T) {
receiver: "opencensus",
skipLifecyle: true, // TODO: Usage of CMux doesn't allow proper shutdown.
},
{
receiver: "oracledb",
},
{
receiver: "otlp",
},
Expand Down
1 change: 1 addition & 0 deletions receiver/oracledbreceiver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
11 changes: 11 additions & 0 deletions receiver/oracledbreceiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Oracle DB receiver

| Status | |
| ------------------------ |----------------------------|
| Stability | [in-development] |
| Supported pipeline types | metrics |
| Distributions | [contrib] |

This receiver collects metrics from an Oracle Database.

The receiver connects to a database host and performs periodically queries.
20 changes: 20 additions & 0 deletions receiver/oracledbreceiver/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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 "go.opentelemetry.io/collector/config"

type Config struct {
config.ReceiverSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
}
16 changes: 16 additions & 0 deletions receiver/oracledbreceiver/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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 implements a receiver collecting metrics from an Oracle datase.
package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver"
44 changes: 44 additions & 0 deletions receiver/oracledbreceiver/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer"
)

const (
typeStr = "oracledb"
stability = component.StabilityLevelInDevelopment
)

// NewFactory creates a new Oracle receiver factory.
func NewFactory() component.ReceiverFactory {
return component.NewReceiverFactory(
typeStr,
createDefaultConfig,
component.WithMetricsReceiver(createMetricsReceiver, stability))
}

func createMetricsReceiver(ctx context.Context, settings component.ReceiverCreateSettings, receiver config.Receiver, metrics consumer.Metrics) (component.MetricsReceiver, error) {
return &oracledbreceiver{}, nil
}

func createDefaultConfig() config.Receiver {
return &Config{ReceiverSettings: config.NewReceiverSettings(config.NewComponentID(typeStr))}
}
30 changes: 30 additions & 0 deletions receiver/oracledbreceiver/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver

go 1.18

require go.opentelemetry.io/collector v0.61.0

require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/knadh/koanf v1.4.3 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
go.opentelemetry.io/collector/pdata v0.61.0 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/metric v0.32.1 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.49.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
Loading

0 comments on commit 3a59b75

Please sign in to comment.