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

Upgrade Contrib To 0.98.0 #1147

Merged
merged 1 commit into from
May 2, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/PR-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
if: needs.changes.outputs.lint == 'true'
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved
cache: false

- name: Check out code
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
if: needs.changes.outputs.build == 'true'
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2
cache: false

- name: Check out code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ec2-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
uses: actions/cache@v3
with:
path: go.mod
key: cache_if_success-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.arc }}-${{ matrix.arrays.test_dir }}
key: ${{inputs.region}}-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.arc }}-${{ matrix.arrays.test_dir }}
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved

- name: Echo Test Info
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2

- name: Generate matrix
id: set-matrix
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ~1.21.1
go-version: ~1.22.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down Expand Up @@ -398,7 +398,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2

- name: SetOutputs
id: set-outputs
Expand Down Expand Up @@ -888,7 +888,7 @@ jobs:
uses: actions/cache@v3
with:
path: go.mod
key: eks-ec2-integration-test-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.test_dir }}
key: ${{ matrix.arrays.terraform_dir }}-${{ matrix.arrays.k8s_version }}-${{ matrix.arrays.instanceType }}-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.test_dir }}
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved

- name: Login ECR
id: login-ecr
Expand All @@ -903,8 +903,8 @@ jobs:
if: steps.eks-ec2-integration-test.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster
max_attempts: 2
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved
timeout_minutes: 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved
retry_wait_seconds: 5
command: |
if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/otel-fork-replace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2
cache: false
- name: Update OTel fork components version
id: set-matrix
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
go-version: ~1.22.2
cache: false

- name: Install rpm
Expand Down
4 changes: 3 additions & 1 deletion cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/influxdata/wlog"
"github.com/kardianos/service"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/otelcol"

configaws "github.com/aws/amazon-cloudwatch-agent/cfg/aws"
Expand Down Expand Up @@ -345,12 +346,13 @@ func runAgent(ctx context.Context,

params := getCollectorParams(factories, provider, writer)

_ = featuregate.GlobalRegistry().Set("exporter.xray.allowDot", true)
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved
cmd := otelcol.NewCommand(params)

// Noticed that args of parent process get passed here to otel collector which causes failures complaining about
// unrecognized args. So below change overwrites the args. Need to investigate this further as I dont think the config
// path below here is actually used and it still respects what was set in the settings above.
e := []string{"--config=" + yamlConfigPath}
e := []string{"--config=" + yamlConfigPath + " --feature-gates=exporter.xray.allowDot"}
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved
cmd.SetArgs(e)

return cmd.Execute()
Expand Down
4 changes: 2 additions & 2 deletions extension/agenthealth/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/aws/amazon-cloudwatch-agent/extension/agenthealth/handler/stats/agent"
)

const (
TypeStr = "agenthealth"
var (
TypeStr, _ = component.NewType("agenthealth")
sethAmazon marked this conversation as resolved.
Show resolved Hide resolved
)

func NewFactory() extension.Factory {
Expand Down
8 changes: 4 additions & 4 deletions extension/agenthealth/handler/useragent/useragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ func (ua *userAgent) SetComponents(otelCfg *otelcol.Config, telegrafCfg *telegra
for _, pipeline := range otelCfg.Service.Pipelines {
for _, receiver := range pipeline.Receivers {
// trim the adapter prefix from adapted Telegraf plugins
name := strings.TrimPrefix(string(receiver.Type()), adapter.TelegrafPrefix)
name := strings.TrimPrefix(receiver.Type().String(), adapter.TelegrafPrefix)
ua.inputs.Add(name)
}
for _, processor := range pipeline.Processors {
ua.processors.Add(string(processor.Type()))
ua.processors.Add(processor.Type().String())
}
for _, exporter := range pipeline.Exporters {
ua.outputs.Add(string(exporter.Type()))
if exporter.Type() == "awsemf" {
ua.outputs.Add(exporter.Type().String())
if exporter.Type().String() == "awsemf" {
cfg := otelCfg.Exporters[exporter].(*awsemfexporter.Config)
if cfg.IsAppSignalsEnabled() {
ua.outputs.Add(flagAppSignals)
Expand Down
29 changes: 19 additions & 10 deletions extension/agenthealth/handler/useragent/useragent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,26 @@ import (
)

func TestSetComponents(t *testing.T) {
metricsType, _ := component.NewType("metrics")
telegrafCPUType, _ := component.NewType(adapter.TelegrafPrefix + "cpu")
prometheusType, _ := component.NewType("prometheus")
batchType, _ := component.NewType("batch")
filterType, _ := component.NewType("filter")
cloudwatchType, _ := component.NewType("cloudwatch")
otelCfg := &otelcol.Config{
Service: service.Config{
Pipelines: map[component.ID]*pipelines.PipelineConfig{
component.NewID("metrics"): {
component.NewID(metricsType): {
Receivers: []component.ID{
component.NewID(adapter.TelegrafPrefix + "cpu"),
component.NewID("prometheus"),
component.NewID(telegrafCPUType),
component.NewID(prometheusType),
},
Processors: []component.ID{
component.NewID("batch"),
component.NewID("filter"),
component.NewID(batchType),
component.NewID(filterType),
},
Exporters: []component.ID{
component.NewID("cloudwatch"),
component.NewID(cloudwatchType),
},
},
},
Expand Down Expand Up @@ -101,21 +107,24 @@ func TestAlternateUserAgent(t *testing.T) {
}

func TestEmf(t *testing.T) {
metricsType, _ := component.NewType("metrics")
nopType, _ := component.NewType("nop")
awsEMFType, _ := component.NewType("awsemf")
otelCfg := &otelcol.Config{
Service: service.Config{
Pipelines: map[component.ID]*pipelines.PipelineConfig{
component.NewID("metrics"): {
component.NewID(metricsType): {
Receivers: []component.ID{
component.NewID("nop"),
component.NewID(nopType),
},
Exporters: []component.ID{
component.NewID("awsemf"),
component.NewID(awsEMFType),
},
},
},
},
Exporters: map[component.ID]component.Config{
component.NewID("awsemf"): &awsemfexporter.Config{Namespace: "AppSignals", LogGroupName: "/aws/appsignals/log/group"},
component.NewID(awsEMFType): &awsemfexporter.Config{Namespace: "AppSignals", LogGroupName: "/aws/appsignals/log/group"},
},
}
ua := newUserAgent()
Expand Down
Loading
Loading