Skip to content

Commit

Permalink
Merge pull request open-telemetry#89 from amazon-contributing/sky3339…
Browse files Browse the repository at this point in the history
…99/merge-aws-cwa-dev

Merge aws-cwa-dev into aws-cwa-apm
  • Loading branch information
sky333999 authored Aug 28, 2023
2 parents 19109a4 + 94c85d9 commit 213c65e
Show file tree
Hide file tree
Showing 66 changed files with 598 additions and 253 deletions.
4 changes: 2 additions & 2 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/google/uuid v1.3.0
github.com/open-telemetry/opentelemetry-collector-contrib v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver v0.77.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector v0.77.0
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/receiver/otlpreceiver v0.77.0
Expand Down Expand Up @@ -277,7 +277,7 @@ require (
github.com/alecthomas/participle/v2 v2.0.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aliyun/aliyun-log-go-sdk v0.1.44 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/antonmedv/expr v1.12.5 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
Expand Down
3 changes: 2 additions & 1 deletion cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions cmd/otelcontribcol/exporters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"runtime"
"testing"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -497,7 +496,6 @@ func TestDefaultExporters(t *testing.T) {
expectedExporters[k] = struct{}{}
}
for _, tt := range tests {
override.IMDSRetryer = nil
_, ok := expFactories[tt.exporter]
if !ok {
// not part of the distro, skipping.
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/otelcontrib
go 1.19

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83
github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.77.0
Expand Down Expand Up @@ -174,7 +173,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver v0.77.0
github.com/prometheus/prometheus v0.43.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector v0.77.0
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/connector/forwardconnector v0.77.0
Expand Down Expand Up @@ -270,6 +269,7 @@ require (
github.com/alecthomas/participle/v2 v2.0.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aliyun/aliyun-log-go-sdk v0.1.44 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/antonmedv/expr v1.12.5 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
Expand Down
3 changes: 2 additions & 1 deletion cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exporter/awscloudwatchlogsexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func newCwLogsPusher(expConfig *Config, params exp.CreateSettings) (*exporter, e
}

// create CWLogs client with aws session config
svcStructuredLog := cwlogs.NewClient(params.Logger, awsConfig, params.BuildInfo, expConfig.LogGroupName, expConfig.LogRetention, session)
svcStructuredLog := cwlogs.NewClient(params.Logger, awsConfig, params.BuildInfo, expConfig.LogGroupName, expConfig.LogRetention, session, false)
collectorIdentifier, err := uuid.NewRandom()

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions exporter/awscloudwatchlogsexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/google/uuid v1.3.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.77.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/confmap v0.77.0
go.opentelemetry.io/collector/consumer v0.77.0
Expand All @@ -19,7 +19,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/awscloudwatchlogsexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion exporter/awsemfexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ type Config struct {
// TODO: we can support directing output to a file (in the future) while customer specifies a file path here.
OutputDestination string `mapstructure:"output_destination"`

// EKSFargateContainerInsightsEnabled is an option to reformat certin metric labels so that they take the form of a high level object
// EKSFargateContainerInsightsEnabled is an option to reformat certain metric labels so that they take the form of a high level object
// The end result will make the labels look like those coming out of ECS and be more easily injected into cloudwatch
// Note that at the moment in order to use this feature the value "kubernetes" must also be added to the ParseJSONEncodedAttributeValues array in order to be used
EKSFargateContainerInsightsEnabled bool `mapstructure:"eks_fargate_container_insights_enabled"`

// EnhancedContainerInsights indicates payloads will include enhanced container insights metrics
EnhancedContainerInsights bool `mapstructure:"enhanced_container_insights"`

// DisableMetricExtraction is an option to disable the extraction of metrics from the EMF logs.
// Setting this to true essentially skips generating and setting the _aws / CloudWatchMetrics section of the EMF log, thus effectively
// retaining all the fields / labels in the EMF log except for the section responsible for extraction of metrics.
Expand Down
22 changes: 22 additions & 0 deletions exporter/awsemfexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@ func TestLoadConfig(t *testing.T) {
logger: zap.NewNop(),
},
},
{
id: component.NewIDWithName(typeStr, "enhanced_container_insights"),
expected: &Config{
AWSSessionSettings: awsutil.AWSSessionSettings{
NumberOfWorkers: 8,
Endpoint: "",
RequestTimeoutSeconds: 30,
MaxRetries: 2,
NoVerifySSL: false,
ProxyAddress: "",
Region: "",
RoleARN: "",
},
LogGroupName: "",
LogStreamName: "",
DimensionRollupOption: "ZeroAndSingleDimensionRollup",
OutputDestination: "cloudwatch",
Version: "1",
EnhancedContainerInsights: true,
logger: zap.NewNop(),
},
},
}

for _, tt := range tests {
Expand Down
6 changes: 5 additions & 1 deletion exporter/awsemfexporter/emf_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newEmfExporter(config *Config, set exporter.CreateSettings) (*emfExporter,
}

// create CWLogs client with aws session config
svcStructuredLog := cwlogs.NewClient(set.Logger, awsConfig, set.BuildInfo, config.LogGroupName, config.LogRetention, session)
svcStructuredLog := cwlogs.NewClient(set.Logger, awsConfig, set.BuildInfo, config.LogGroupName, config.LogRetention, session, isEnhancedContainerInsights(config))
collectorIdentifier, err := uuid.NewRandom()

if err != nil {
Expand Down Expand Up @@ -198,3 +198,7 @@ func wrapErrorIfBadRequest(err error) error {
}
return err
}

func isEnhancedContainerInsights(config *Config) bool {
return config.EnhancedContainerInsights && !config.DisableMetricExtraction
}
13 changes: 13 additions & 0 deletions exporter/awsemfexporter/emf_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,16 @@ func TestNewEmfExporterWithoutConfig(t *testing.T) {
assert.Nil(t, exp)
assert.Equal(t, settings.Logger, expCfg.logger)
}

func TestIsEnhancedContainerInsights(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig().(*Config)
cfg.EnhancedContainerInsights = true
cfg.DisableMetricExtraction = false
assert.True(t, isEnhancedContainerInsights(cfg))
cfg.EnhancedContainerInsights = false
assert.False(t, isEnhancedContainerInsights(cfg))
cfg.EnhancedContainerInsights = true
cfg.DisableMetricExtraction = true
assert.False(t, isEnhancedContainerInsights(cfg))
}
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.77.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/confmap v0.77.0
go.opentelemetry.io/collector/consumer v0.77.0
Expand All @@ -24,7 +24,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions exporter/awsemfexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ awsemf/metric_descriptors:
overwrite: true
awsemf/disable_metric_extraction:
disable_metric_extraction: true
awsemf/enhanced_container_insights:
enhanced_container_insights: true
4 changes: 2 additions & 2 deletions exporter/awsxrayexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.77.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/confmap v0.77.0
go.opentelemetry.io/collector/consumer v0.77.0
Expand All @@ -18,7 +18,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsxrayexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions exporter/datadogexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ package datadogexporter
import (
"testing"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/confmap"
)

func TestValidate(t *testing.T) {
override.IMDSRetryer = nil
tests := []struct {
name string
cfg *Config
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.2.0
github.com/DataDog/sketches-go v1.4.2
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.13.1
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83
github.com/aws/aws-sdk-go v1.44.309
github.com/cenkalti/backoff/v4 v4.2.1
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.77.0
Expand All @@ -26,7 +25,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.77.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector v0.77.0
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/confmap v0.77.0
Expand Down Expand Up @@ -62,6 +61,7 @@ require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Showmax/go-fqdn v1.0.0 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/antonmedv/expr v1.12.5 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion exporter/datadogexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/azure"
override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -65,7 +64,6 @@ var (
)

func TestFillHostMetadata(t *testing.T) {
override.IMDSRetryer = nil
params := exportertest.NewNopCreateSettings()
params.BuildInfo = mockBuildInfo

Expand Down
4 changes: 2 additions & 2 deletions extension/awsproxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ go 1.19
require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.77.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector v0.77.0
go.opentelemetry.io/collector/component v0.77.0
go.opentelemetry.io/collector/confmap v0.77.0
go.uber.org/zap v1.24.0
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230818193829-04a761abd409 // indirect
github.com/aws/aws-sdk-go v1.44.309 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down
Loading

0 comments on commit 213c65e

Please sign in to comment.