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/webhookevent] First commit #19377

Merged
merged 13 commits into from
Mar 10, 2023
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
16 changes: 16 additions & 0 deletions .chloggen/generic_webhook_wireframe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: new_component

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: webhookeventreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: New component wireframe for webhookeventreceiver

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

# (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 @@ -230,6 +230,7 @@ receiver/tcplogreceiver/ @open-telemetry/collect
receiver/udplogreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski
receiver/vcenterreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @schmikei
receiver/wavefrontreceiver/ @open-telemetry/collector-contrib-approvers @pjanotti
receiver/webhookeventreceiver/ @open-telemetry/collector-contrib-approvers @atoulme @shalper2
receiver/windowseventlogreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @armstrmi
receiver/windowsperfcountersreceiver/ @open-telemetry/collector-contrib-approvers @dashpole
receiver/zipkinreceiver/ @open-telemetry/collector-contrib-approvers
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ body:
- receiver/udplog
- receiver/vcenter
- receiver/wavefront
- receiver/webhookevent
- receiver/windowseventlog
- receiver/windowsperfcounters
- receiver/zipkin
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ body:
- receiver/udplog
- receiver/vcenter
- receiver/wavefront
- receiver/webhookevent
- receiver/windowseventlog
- receiver/windowsperfcounters
- receiver/zipkin
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ body:
- receiver/udplog
- receiver/vcenter
- receiver/wavefront
- receiver/webhookevent
- receiver/windowseventlog
- receiver/windowsperfcounters
- receiver/zipkin
Expand Down
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,11 @@ updates:
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/receiver/webhookeventreceiver"
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/receiver/windowseventlogreceiver"
schedule:
Expand Down Expand Up @@ -1097,8 +1102,3 @@ updates:
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/testbed/mockdatasenders/mockdatadogagentexporter"
schedule:
interval: "weekly"
day: "wednesday"
2 changes: 2 additions & 0 deletions receiver/webhookeventreceiver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include ../../Makefile.Common

11 changes: 11 additions & 0 deletions receiver/webhookeventreceiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Webhook Event Receiver

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

The Webhook Event receiver is meantWebhook Event to act as a generally available push based receiver for any webhook style data source.

[development]: https://github.com/open-telemetry/opentelemetry-collector#development
24 changes: 24 additions & 0 deletions receiver/webhookeventreceiver/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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 webhookeventreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/webhookeventreceiver"

import (
"go.opentelemetry.io/collector/config/confighttp"
)

// Config defines configuration for the Generic Webhook receiver.
type Config struct {
confighttp.HTTPServerSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
}
15 changes: 15 additions & 0 deletions receiver/webhookeventreceiver/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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 webhookeventreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/genericwebhookreceiver"
63 changes: 63 additions & 0 deletions receiver/webhookeventreceiver/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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 webhookeventreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/webhookeventreceiver"

import (
"context"

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

const (
// The value of "type" key in configuration.
typeStr = "generic_webhook"
// The stability level of the receiver.
stability = component.StabilityLevelDevelopment
// Default endpoints to bind to.
defaultEndpoint = ":8080"
)

// NewFactory creates a factory for Generic Webhook Receiver.
func NewFactory() component.Factory {
return receiver.NewFactory(
typeStr,
createDefaultConfig,
receiver.WithLogs(createLogsReceiver, stability),
)
}

// Default configuration for the generic webhook receiver
func createDefaultConfig() component.Config {
return &Config{
HTTPServerSettings: confighttp.HTTPServerSettings{
Endpoint: defaultEndpoint,
},
}
}

// createLogsReceiver creates a logs receiver based on provided config.
func createLogsReceiver(
_ context.Context,
params receiver.CreateSettings,
cfg component.Config,
consumer consumer.Logs,
) (receiver.Logs, error) {
conf := cfg.(*Config)

return newLogsReceiver(params, *conf, consumer)
}
15 changes: 15 additions & 0 deletions receiver/webhookeventreceiver/factory_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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 webhookeventreceiver
44 changes: 44 additions & 0 deletions receiver/webhookeventreceiver/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/webhookeventreceiver

go 1.19

require (
go.opentelemetry.io/collector v0.73.0
go.opentelemetry.io/collector/component v0.73.0
go.opentelemetry.io/collector/consumer v0.73.0
go.opentelemetry.io/collector/receiver v0.73.0
)

require (
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/knadh/koanf v1.5.0 // 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
github.com/rs/cors v1.8.3 // indirect
go.opentelemetry.io/collector/confmap v0.73.0 // indirect
go.opentelemetry.io/collector/featuregate v0.73.0 // indirect
go.opentelemetry.io/collector/pdata v1.0.0-rc7 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.39.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/metric v0.37.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
Loading