diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7dace4016ce6..a4865d9b7f72 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -45,7 +45,7 @@ exporter/googlecloudpubsubexporter/ @open-telemetry/collector-c exporter/tanzuobservabilityexporter/ @open-telemetry/collector-contrib-approvers @oppegard @thepeterstone exporter/influxdbexporter/ @open-telemetry/collector-contrib-approvers @jacobmarble @8none1 -extension/awsxrayproxy/ @open-telemetry/collector-contrib-approvers @anuraaga @Aneurysm9 @mxiamxia +extension/awsproxy/ @open-telemetry/collector-contrib-approvers @anuraaga @Aneurysm9 @mxiamxia extension/httpforwarder/ @open-telemetry/collector-contrib-approvers @asuresh4 extension/observer/ @open-telemetry/collector-contrib-approvers @asuresh4 @jrcamp diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a3a5517d713c..65ff48da1b52 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -170,7 +170,7 @@ updates: schedule: interval: "weekly" - package-ecosystem: "gomod" - directory: "/extension/awsxrayproxy" + directory: "/extension/awsproxy" schedule: interval: "weekly" - package-ecosystem: "gomod" diff --git a/extension/awsxrayproxy/Makefile b/extension/awsproxy/Makefile similarity index 100% rename from extension/awsxrayproxy/Makefile rename to extension/awsproxy/Makefile diff --git a/extension/awsproxy/README.md b/extension/awsproxy/README.md new file mode 100644 index 000000000000..0bd1d0f234f0 --- /dev/null +++ b/extension/awsproxy/README.md @@ -0,0 +1,51 @@ +# AWS Proxy + +## +The AWS proxy accepts requests without any authentication of AWS signatures applied and forwards them to the +AWS API, applying authentication and signing. This allows applications to avoid needing AWS credentials to access +a service, instead configuring the AWS exporter and/or proxy in the OpenTelemetry collector and only providing the +collector with credentials. + +## Configuration + +Example: + +```yaml +extensions: + awsproxy: + endpoint: 0.0.0.0:2000 + proxy_address: "" + tls: + insecure: false + server_name_override: "" + region: "" + role_arn: "" + aws_endpoint: "" + local_mode: false +``` + +### endpoint (Optional) +The TCP address and port on which this proxy listens for requests. + +Default: `0.0.0.0:2000` + +### proxy_address (Optional) +Defines the proxy address that this extension forwards HTTP requests to the AWS backend through. If left unconfigured, requests will be sent directly. +This will generally be set to a NAT gateway when the collector is running on a network without public internet. + +### insecure (Optional) +Enables or disables TLS certificate verification when this proxy forwards HTTP requests to the AWS backend. This sets the `InsecureSkipVerify` in the [TLSConfig](https://godoc.org/crypto/tls#Config). When setting to true, TLS is susceptible to man-in-the-middle attacks so it should be used only for testing. + +Default: `false` + +### server_name_override (Optional) +This sets the ``ServerName` in the [TLSConfig](https://godoc.org/crypto/tls#Config). + +### region (Optional) +The AWS region this proxy forwards requests to. When missing, we will try to retrieve this value through environment variables or optionally ECS/EC2 metadata endpoint (depends on `local_mode` below). + +### role_arn (Optional) +The IAM role used by this proxy when communicating with the AWS service. If non-empty, the receiver will attempt to call STS to retrieve temporary credentials, otherwise the standard AWS credential [lookup](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials) will be performed. + +### aws_endpoint (Optional) +The AWS service endpoint which this proxy forwards requests to. If not set, will default to the AWS X-Ray endpoint. diff --git a/extension/awsxrayproxy/config.go b/extension/awsproxy/config.go similarity index 98% rename from extension/awsxrayproxy/config.go rename to extension/awsproxy/config.go index 19556a85bce0..44ce0cceae6f 100644 --- a/extension/awsxrayproxy/config.go +++ b/extension/awsproxy/config.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package awsxrayproxy +package awsproxy import ( "go.opentelemetry.io/collector/config" diff --git a/extension/awsxrayproxy/config_test.go b/extension/awsproxy/config_test.go similarity index 99% rename from extension/awsxrayproxy/config_test.go rename to extension/awsproxy/config_test.go index dba319b77ed3..ea7a6dcd016c 100644 --- a/extension/awsxrayproxy/config_test.go +++ b/extension/awsproxy/config_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package awsxrayproxy +package awsproxy import ( "path" diff --git a/extension/awsxrayproxy/extension.go b/extension/awsproxy/extension.go similarity index 98% rename from extension/awsxrayproxy/extension.go rename to extension/awsproxy/extension.go index a541e1d59bae..b7968eec5c05 100644 --- a/extension/awsxrayproxy/extension.go +++ b/extension/awsproxy/extension.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package awsxrayproxy +package awsproxy import ( "context" diff --git a/extension/awsxrayproxy/extension_test.go b/extension/awsproxy/extension_test.go similarity index 98% rename from extension/awsxrayproxy/extension_test.go rename to extension/awsproxy/extension_test.go index 2fbcd4f2886e..af4d94f4b856 100644 --- a/extension/awsxrayproxy/extension_test.go +++ b/extension/awsproxy/extension_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package awsxrayproxy +package awsproxy import ( "testing" diff --git a/extension/awsxrayproxy/factory.go b/extension/awsproxy/factory.go similarity index 94% rename from extension/awsxrayproxy/factory.go rename to extension/awsproxy/factory.go index 391ee9eb402f..3ee21a5e6e27 100644 --- a/extension/awsxrayproxy/factory.go +++ b/extension/awsproxy/factory.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package awsxrayproxy +package awsproxy import ( "context" @@ -28,12 +28,12 @@ import ( const ( // The value of extension "type" in configuration. - typeStr = "awsxrayproxy" + typeStr = "awsproxy" defaultEndpoint = "0.0.0.0:2000" ) -// NewFactory creates a factory for awsxrayproxy extension. +// NewFactory creates a factory for awsproxy extension. func NewFactory() component.ExtensionFactory { return extensionhelper.NewFactory( typeStr, diff --git a/extension/awsxrayproxy/factory_test.go b/extension/awsproxy/factory_test.go similarity index 99% rename from extension/awsxrayproxy/factory_test.go rename to extension/awsproxy/factory_test.go index 2a666e692bed..b2ede9860a26 100644 --- a/extension/awsxrayproxy/factory_test.go +++ b/extension/awsproxy/factory_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package awsxrayproxy +package awsproxy import ( "context" diff --git a/extension/awsxrayproxy/go.mod b/extension/awsproxy/go.mod similarity index 98% rename from extension/awsxrayproxy/go.mod rename to extension/awsproxy/go.mod index 6be22533c77e..aa9b9e42b364 100644 --- a/extension/awsxrayproxy/go.mod +++ b/extension/awsproxy/go.mod @@ -1,4 +1,4 @@ -module github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsxrayproxy +module github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy go 1.17 diff --git a/extension/awsxrayproxy/go.sum b/extension/awsproxy/go.sum similarity index 100% rename from extension/awsxrayproxy/go.sum rename to extension/awsproxy/go.sum diff --git a/extension/awsxrayproxy/testdata/config.yaml b/extension/awsproxy/testdata/config.yaml similarity index 88% rename from extension/awsxrayproxy/testdata/config.yaml rename to extension/awsproxy/testdata/config.yaml index 7ec098912551..2ccbebc555c0 100644 --- a/extension/awsxrayproxy/testdata/config.yaml +++ b/extension/awsproxy/testdata/config.yaml @@ -1,6 +1,6 @@ extensions: - awsxrayproxy: - awsxrayproxy/1: + awsproxy: + awsproxy/1: endpoint: "0.0.0.0:1234" proxy_address: "https://proxy.proxy.com" tls: @@ -11,7 +11,7 @@ extensions: aws_endpoint: "https://another.aws.endpoint.com" service: - extensions: [awsxrayproxy/1] + extensions: [awsproxy/1] pipelines: traces: receivers: [nop] diff --git a/extension/awsxrayproxy/README.md b/extension/awsxrayproxy/README.md deleted file mode 100644 index 02fc365b1870..000000000000 --- a/extension/awsxrayproxy/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# AWS X-Ray Proxy - -## -The AWS X-Ray proxy accepts requests without any authentication of AWS signatures applied and forwards them to the -AWS X-Ray API, applying authentication and signing. This allows applications to avoid needing AWS credentials to enable -X-Ray, instead configuring the AWS X-Ray exporter and/or proxy in the OpenTelemetry collector and only providing the -collector with credentials. - -Currently, only the X-Ray Remote Sampler uses this proxy when issuing sampling requests. - -## Configuration - -Example: - -```yaml -extensions: - awsxrayproxy: - endpoint: 0.0.0.0:2000 - proxy_address: "" - tls: - insecure: false - server_name_override: "" - region: "" - role_arn: "" - aws_endpoint: "" - local_mode: false -``` - -The default configurations below are based on the [default configurations](https://github.com/aws/aws-xray-daemon/blob/master/pkg/cfg/cfg.go#L99) of the existing X-Ray Daemon. - -### endpoint (Optional) -The TCP address and port on which this proxy listens for requests. - -Default: `0.0.0.0:2000` - -### proxy_address (Optional) -Defines the proxy address that this extension forwards HTTP requests to the AWS X-Ray backend through. If left unconfigured, requests will be sent directly. -This will generally be set to a NAT gateway when the collector is running on a network without public internet. - -### insecure (Optional) -Enables or disables TLS certificate verification when this proxy forwards HTTP requests to the AWS X-Ray backend. This sets the `InsecureSkipVerify` in the [TLSConfig](https://godoc.org/crypto/tls#Config). When setting to true, TLS is susceptible to man-in-the-middle attacks so it should be used only for testing. - -Default: `false` - -### server_name_override (Optional) -This sets the ``ServerName` in the [TLSConfig](https://godoc.org/crypto/tls#Config). - -### region (Optional) -The AWS region this proxy forwards requests to. When missing, we will try to retrieve this value through environment variables or optionally ECS/EC2 metadata endpoint (depends on `local_mode` below). - -### role_arn (Optional) -The IAM role used by this proxy when communicating with the AWS X-Ray service. If non-empty, the receiver will attempt to call STS to retrieve temporary credentials, otherwise the standard AWS credential [lookup](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials) will be performed. - -### aws_endpoint (Optional) -The X-Ray service endpoint which this proxy forwards requests to. diff --git a/go.mod b/go.mod index 5dad9d1a83a5..33d6cd6b52e9 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter v0.37.1 github.com/open-telemetry/opentelemetry-collector-contrib/exporter/tanzuobservabilityexporter v0.37.1 github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.37.1 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.37.1 github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension v0.37.1 github.com/open-telemetry/opentelemetry-collector-contrib/extension/fluentbitextension v0.37.1 github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.37.1 @@ -469,6 +470,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elast replace github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter => ./exporter/zipkinexporter +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy => ./extension/awsproxy + replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension => ./extension/bearertokenauthextension replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/fluentbitextension => ./extension/fluentbitextension diff --git a/internal/components/components.go b/internal/components/components.go index f37d7a054854..58576c0a009d 100644 --- a/internal/components/components.go +++ b/internal/components/components.go @@ -51,6 +51,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/tanzuobservabilityexporter" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter" + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/fluentbitextension" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension" @@ -124,6 +125,7 @@ func Components() (component.Factories, error) { delete(factories.Extensions, "pprof") extensions := []component.ExtensionFactory{ + awsproxy.NewFactory(), bearertokenauthextension.NewFactory(), filestorage.NewFactory(), fluentbitextension.NewFactory(), diff --git a/internal/components/extensions_test.go b/internal/components/extensions_test.go index c44a82b97e46..a90b76c79341 100644 --- a/internal/components/extensions_test.go +++ b/internal/components/extensions_test.go @@ -85,7 +85,7 @@ func TestDefaultExtensions(t *testing.T) { } // * The OIDC Auth extension requires an OIDC server to get the config from, and we don't want to spawn one here for this test. - assert.Equal(t, len(tests)+7 /* not tested */, len(extFactories)) + assert.Equal(t, len(tests)+8 /* not tested */, len(extFactories)) for _, tt := range tests { t.Run(string(tt.extension), func(t *testing.T) { diff --git a/versions.yaml b/versions.yaml index 656314d1a85b..fd30d033db24 100644 --- a/versions.yaml +++ b/versions.yaml @@ -20,6 +20,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/cmd/configschema - github.com/open-telemetry/opentelemetry-collector-contrib/cmd/mdatagen - github.com/open-telemetry/opentelemetry-collector-contrib/tracegen + - github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy - github.com/open-telemetry/opentelemetry-collector-contrib/extension/fluentbitextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/oidcauthextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension @@ -33,7 +34,6 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/hostobserver - github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage - - github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsxrayproxy - github.com/open-telemetry/opentelemetry-collector-contrib/testbed - github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor