Skip to content

Commit

Permalink
Wire up awsxrayproxy extension (#5747)
Browse files Browse the repository at this point in the history
* Wire up awsxrayproxy extension

* Update test

* Versions.yaml

* Rename to awsproxy
  • Loading branch information
anuraaga authored Oct 19, 2021
1 parent 9ff0e37 commit 0a8bed1
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ updates:
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/extension/awsxrayproxy"
directory: "/extension/awsproxy"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions extension/awsproxy/README.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package awsxrayproxy
package awsproxy

import (
"path"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package awsxrayproxy
package awsproxy

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package awsxrayproxy
package awsproxy

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package awsxrayproxy
package awsproxy

import (
"context"
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package awsxrayproxy
package awsproxy

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extensions:
awsxrayproxy:
awsxrayproxy/1:
awsproxy:
awsproxy/1:
endpoint: "0.0.0.0:1234"
proxy_address: "https://proxy.proxy.com"
tls:
Expand All @@ -11,7 +11,7 @@ extensions:
aws_endpoint: "https://another.aws.endpoint.com"

service:
extensions: [awsxrayproxy/1]
extensions: [awsproxy/1]
pipelines:
traces:
receivers: [nop]
Expand Down
55 changes: 0 additions & 55 deletions extension/awsxrayproxy/README.md

This file was deleted.

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -124,6 +125,7 @@ func Components() (component.Factories, error) {
delete(factories.Extensions, "pprof")

extensions := []component.ExtensionFactory{
awsproxy.NewFactory(),
bearertokenauthextension.NewFactory(),
filestorage.NewFactory(),
fluentbitextension.NewFactory(),
Expand Down
2 changes: 1 addition & 1 deletion internal/components/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0a8bed1

Please sign in to comment.