Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/azureeventhub] Add new component, Azure Event Hub Receiver #12787

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ processor/spanprocessor/ @open-telemetry/collector-c
processor/tailsamplingprocessor/ @open-telemetry/collector-contrib-approvers @jpkrohling
processor/transformprocessor/ @open-telemetry/collector-contrib-approvers @TylerHelmuth @kentquirk @bogdandrutu

receiver/azureeventhubreceiver/ @open-telemetry/collector-contrib-approvers @atoulme @djaglowski
receiver/activedirectorydsreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @binaryfissiongames
receiver/aerospikereceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @antonblock
receiver/apachereceiver/ @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 @@ -387,6 +387,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.57.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver v0.57.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.57.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver v0.57.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver v0.57.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.57.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver v0.57.2 // indirect
Expand Down Expand Up @@ -819,6 +820,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfi

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

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

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

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/couchdbreceiver => ../../receiver/couchdbreceiver
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.57.2
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver v0.57.2
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.57.2
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver v0.57.2
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver v0.57.2
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.57.2
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver v0.57.2
Expand Down Expand Up @@ -823,6 +824,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfi

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

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

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

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver => ./receiver/carbonreceiver
Expand Down
2 changes: 2 additions & 0 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver"
Expand Down Expand Up @@ -207,6 +208,7 @@ func Components() (component.Factories, error) {
awsecscontainermetricsreceiver.NewFactory(),
awsfirehosereceiver.NewFactory(),
awsxrayreceiver.NewFactory(),
azureeventhubreceiver.NewFactory(),
bigipreceiver.NewFactory(),
carbonreceiver.NewFactory(),
chronyreceiver.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 @@ -81,6 +81,9 @@ func TestDefaultReceivers(t *testing.T) {
receiver: "awsxray",
skipLifecyle: true, // Requires AWS endpoint to check identity to run
},
{
receiver: "azureeventhub",
},
{
receiver: "bigip",
},
Expand Down
1 change: 1 addition & 0 deletions receiver/azureeventhubreceiver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
39 changes: 39 additions & 0 deletions receiver/azureeventhubreceiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Azure Event Hub Receiver

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

## Overview
The Azure Event Hub receiver listens to logs emitted by Azure Event hubs.

## Configuration

### connection (Required)
A string describing the connection to an Azure event hub.

### partition (Optional)
The partition to watch. If empty, it will watch explicitly all partitions.

Default: ""

### offset (Optional)
The offset at which to start watching the event hub. If empty, it starts with the latest offset.

Default: ""

Example:

```yaml
receivers:
azureeventhub:
connection: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=;EntityPath=hubName
partition: foo
offset: "1234-5566"
TODO
```

[in-development]: https://github.com/open-telemetry/opentelemetry-collector#in-development
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
31 changes: 31 additions & 0 deletions receiver/azureeventhubreceiver/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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 azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"
import (
"context"

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

type client struct {
}

func (c client) Start(ctx context.Context, host component.Host) error {
return nil
}

func (c client) Shutdown(ctx context.Context) error {
return nil
}
16 changes: 16 additions & 0 deletions receiver/azureeventhubreceiver/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 azureeventhubreceiver listens to logs emitted by Azure Event hubs.
package azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"
50 changes: 50 additions & 0 deletions receiver/azureeventhubreceiver/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// 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 azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"

import (
"context"

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

const (
// The value of "type" key in configuration.
typeStr = "azureeventhub"
// The stability level of the exporter.
stability = component.StabilityLevelInDevelopment
)

type Config struct {
config.ReceiverSettings `mapstructure:",squash"`
}

// NewFactory creates a factory for the Azure Event Hub receiver.
func NewFactory() component.ReceiverFactory {
return component.NewReceiverFactory(
typeStr,
createDefaultConfig,
component.WithLogsReceiver(createLogsReceiver, stability))
}

func createDefaultConfig() config.Receiver {
return &Config{ReceiverSettings: config.NewReceiverSettings(config.NewComponentID(typeStr))}
}

func createLogsReceiver(ctx context.Context, settings component.ReceiverCreateSettings, receiver config.Receiver, logs consumer.Logs) (component.LogsReceiver, error) {
return &client{}, nil
}
30 changes: 30 additions & 0 deletions receiver/azureeventhubreceiver/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/azureeventhubreceiver

go 1.17

require go.opentelemetry.io/collector v0.57.2

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.2 // 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.57.2 // indirect
go.opentelemetry.io/otel v1.8.0 // indirect
go.opentelemetry.io/otel/metric v0.31.0 // indirect
go.opentelemetry.io/otel/trace v1.8.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
Loading