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

Unify Application Signals export template #1430

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,47 @@ exporters:
- dimensions:
- - Environment
- Operation
- RemoteEnvironment
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- Operation
- RemoteEnvironment
- RemoteOperation
- RemoteService
- Service
- - Environment
- Operation
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- Operation
- RemoteOperation
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteService
- Service
- - Environment
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteOperation
- RemoteService
- Service
- - Environment
Expand Down
30 changes: 30 additions & 0 deletions translator/tocwconfig/sampleConfig/base_appsignals_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,47 @@ exporters:
- dimensions:
- - Environment
- Operation
- RemoteEnvironment
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- Operation
- RemoteEnvironment
- RemoteOperation
- RemoteService
- Service
- - Environment
- Operation
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- Operation
- RemoteOperation
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteService
- Service
- - Environment
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteOperation
- RemoteService
- Service
- - Environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,47 @@ exporters:
- dimensions:
- - Environment
- Operation
- RemoteEnvironment
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- Operation
- RemoteEnvironment
- RemoteOperation
- RemoteService
- Service
- - Environment
- Operation
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- Operation
- RemoteOperation
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteService
- Service
- - Environment
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteOperation
- RemoteResourceIdentifier
- RemoteResourceType
- RemoteService
- Service
- - Environment
- RemoteEnvironment
- RemoteOperation
- RemoteService
- Service
- - Environment
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we are removing eks and k8s yaml configs?

Not sure where the differences were...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we are removing eks and k8s yaml configs?

The appsignals_config_generic.yaml is now identical to eks and k8s yaml configs now.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ metric_declarations:
- Fault
- Error
- dimensions:
- [Environment, Service, Operation, RemoteService, RemoteOperation, RemoteEnvironment, RemoteResourceIdentifier, RemoteResourceType]
- [Environment, Service, Operation, RemoteService, RemoteOperation, RemoteEnvironment]
- [Environment, Service, Operation, RemoteService, RemoteOperation, RemoteResourceIdentifier, RemoteResourceType]
- [Environment, Service, Operation, RemoteService, RemoteOperation]
- [Environment, Service, RemoteService, RemoteEnvironment]
- [Environment, Service, RemoteService]
- [Environment, Service, RemoteService, RemoteOperation, RemoteEnvironment, RemoteResourceIdentifier, RemoteResourceType]
- [Environment, Service, RemoteService, RemoteOperation, RemoteEnvironment]
- [Environment, Service, RemoteService, RemoteOperation, RemoteResourceIdentifier, RemoteResourceType]
- [Environment, Service, RemoteService, RemoteOperation]
- [Environment, Service, RemoteService, RemoteResourceIdentifier, RemoteResourceType]
Expand Down

This file was deleted.

34 changes: 1 addition & 33 deletions translator/translate/otel/exporter/awsemf/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common"
"github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth"
"github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/awscontainerinsight"
"github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil"
)

const (
Expand All @@ -44,12 +43,6 @@ var defaultKubernetesKueueConfig string
//go:embed awsemf_default_prometheus.yaml
var defaultPrometheusConfig string

//go:embed appsignals_config_eks.yaml
var appSignalsConfigEks string

//go:embed appsignals_config_k8s.yaml
var appSignalsConfigK8s string

//go:embed appsignals_config_generic.yaml
var appSignalsConfigGeneric string

Expand Down Expand Up @@ -92,7 +85,7 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) {

defaultConfig := defaultGenericConfig
if t.isAppSignals(c) {
defaultConfig = getAppSignalsConfig()
defaultConfig = appSignalsConfigGeneric
} else if t.isCiJMX(c) {
defaultConfig = defaultJmxConfig
} else if isEcs(c) {
Expand Down Expand Up @@ -163,31 +156,6 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) {
return cfg, nil
}

func getAppSignalsConfig() string {
ctx := context.CurrentContext()

mode := ctx.KubernetesMode()
if mode == "" {
mode = ctx.Mode()
}
if mode == config.ModeEC2 {
if ecsutil.GetECSUtilSingleton().IsECS() {
mode = config.ModeECS
}
}

switch mode {
case config.ModeEKS:
return appSignalsConfigEks
case config.ModeK8sEC2, config.ModeK8sOnPrem:
return appSignalsConfigK8s
case config.ModeEC2, config.ModeECS:
return appSignalsConfigGeneric
default:
return appSignalsConfigGeneric
}
}

func (t *translator) isAppSignals(conf *confmap.Conf) bool {
return (t.name == common.AppSignals || t.name == common.AppSignalsFallback) && (conf.IsSet(common.AppSignalsMetrics) || conf.IsSet(common.AppSignalsTraces) || conf.IsSet(common.AppSignalsMetricsFallback) || conf.IsSet(common.AppSignalsTracesFallback))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ func TestTranslateAppSignals(t *testing.T) {
"application_signals": map[string]any{},
},
}},
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_eks.yaml"), map[string]any{
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_generic.yaml"), map[string]any{
"local_mode": "false",
"region": "us-east-1",
"role_arn": "global_arn",
Expand All @@ -944,7 +944,7 @@ func TestTranslateAppSignals(t *testing.T) {
"application_signals": map[string]any{},
},
}},
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_k8s.yaml"), map[string]any{
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_generic.yaml"), map[string]any{
"local_mode": "true",
"region": "us-east-1",
"role_arn": "global_arn",
Expand Down Expand Up @@ -992,7 +992,7 @@ func TestTranslateAppSignals(t *testing.T) {
"app_signals": map[string]any{},
},
}},
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_eks.yaml"), map[string]any{
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_generic.yaml"), map[string]any{
"local_mode": "false",
"region": "us-east-1",
"role_arn": "global_arn",
Expand All @@ -1008,7 +1008,7 @@ func TestTranslateAppSignals(t *testing.T) {
"app_signals": map[string]any{},
},
}},
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_k8s.yaml"), map[string]any{
want: testutil.GetConfWithOverrides(t, filepath.Join("appsignals_config_generic.yaml"), map[string]any{
"local_mode": "true",
"region": "us-east-1",
"role_arn": "global_arn",
Expand Down
Loading