From 54e4375758580aabab44857a9f100186732f3483 Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Mon, 23 Dec 2024 14:20:51 -0500 Subject: [PATCH 1/8] Add awsentity processor into EMF pipeline --- plugins/processors/awsentity/factory.go | 24 ++++++++++++++++++- plugins/processors/awsentity/processor.go | 5 ++++ .../otel/pipeline/emf_logs/translator.go | 3 ++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/plugins/processors/awsentity/factory.go b/plugins/processors/awsentity/factory.go index 32887ffa6a..59f7b22c4b 100644 --- a/plugins/processors/awsentity/factory.go +++ b/plugins/processors/awsentity/factory.go @@ -26,7 +26,9 @@ func NewFactory() processor.Factory { return processor.NewFactory( TypeStr, createDefaultConfig, - processor.WithMetrics(createMetricsProcessor, stability)) + processor.WithMetrics(createMetricsProcessor, stability), + processor.WithLogs(createLogsProcessor, stability), + ) } func createDefaultConfig() component.Config { @@ -53,3 +55,23 @@ func createMetricsProcessor( metricsProcessor.processMetrics, processorhelper.WithCapabilities(processorCapabilities)) } + +func createLogsProcessor( + ctx context.Context, + set processor.CreateSettings, + cfg component.Config, + nextConsumer consumer.Logs, +) (processor.Logs, error) { + processorConfig, ok := cfg.(*Config) + if !ok { + return nil, errors.New("configuration parsing error") + } + logProcessor := newAwsEntityProcessor(processorConfig, set.Logger) + return processorhelper.NewLogsProcessor( + ctx, + set, + cfg, + nextConsumer, + logProcessor.processLogs, + processorhelper.WithCapabilities(processorCapabilities)) +} diff --git a/plugins/processors/awsentity/processor.go b/plugins/processors/awsentity/processor.go index bd1a63b079..0e0ca2fd54 100644 --- a/plugins/processors/awsentity/processor.go +++ b/plugins/processors/awsentity/processor.go @@ -5,6 +5,7 @@ package awsentity import ( "context" + "go.opentelemetry.io/collector/pdata/plog" "strings" "github.com/go-playground/validator/v10" @@ -110,6 +111,10 @@ func newAwsEntityProcessor(config *Config, logger *zap.Logger) *awsEntityProcess } } +func (p *awsEntityProcessor) processLogs(_ context.Context, ld plog.Logs) (plog.Logs, error) { + return ld, nil +} + func (p *awsEntityProcessor) processMetrics(_ context.Context, md pmetric.Metrics) (pmetric.Metrics, error) { // Get the following metric attributes from the EntityStore: PlatformType, EC2.InstanceId, EC2.AutoScalingGroup diff --git a/translator/translate/otel/pipeline/emf_logs/translator.go b/translator/translate/otel/pipeline/emf_logs/translator.go index c155b8176c..0c58e419c6 100644 --- a/translator/translate/otel/pipeline/emf_logs/translator.go +++ b/translator/translate/otel/pipeline/emf_logs/translator.go @@ -4,6 +4,7 @@ package emf_logs import ( + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/awsentity" "strings" "go.opentelemetry.io/collector/component" @@ -48,7 +49,7 @@ func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators } translators := common.ComponentTranslators{ Receivers: common.NewTranslatorMap[component.Config](), - Processors: common.NewTranslatorMap(batchprocessor.NewTranslatorWithNameAndSection(common.PipelineNameEmfLogs, common.LogsKey)), // EMF logs sit under metrics_collected in "logs" + Processors: common.NewTranslatorMap(batchprocessor.NewTranslatorWithNameAndSection(common.PipelineNameEmfLogs, common.LogsKey), awsentity.NewTranslatorWithEntityType(awsentity.Service, "emf", false)), // EMF logs sit under metrics_collected in "logs" Exporters: common.NewTranslatorMap(awscloudwatchlogs.NewTranslatorWithName(common.PipelineNameEmfLogs)), Extensions: common.NewTranslatorMap(agenthealth.NewTranslator(component.DataTypeLogs, []string{agenthealth.OperationPutLogEvents}), agenthealth.NewTranslatorWithStatusCode(component.MustNewType("statuscode"), nil, true), From 2815c348f6d984d7ede870979771faabab3e2166 Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Mon, 23 Dec 2024 14:27:31 -0500 Subject: [PATCH 2/8] Fix linter errors --- plugins/processors/awsentity/processor.go | 2 +- translator/translate/otel/pipeline/emf_logs/translator.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/processors/awsentity/processor.go b/plugins/processors/awsentity/processor.go index 0e0ca2fd54..b39f4ec8c1 100644 --- a/plugins/processors/awsentity/processor.go +++ b/plugins/processors/awsentity/processor.go @@ -5,11 +5,11 @@ package awsentity import ( "context" - "go.opentelemetry.io/collector/pdata/plog" "strings" "github.com/go-playground/validator/v10" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" semconv "go.opentelemetry.io/collector/semconv/v1.22.0" "go.uber.org/zap" diff --git a/translator/translate/otel/pipeline/emf_logs/translator.go b/translator/translate/otel/pipeline/emf_logs/translator.go index 0c58e419c6..aaecb49e7f 100644 --- a/translator/translate/otel/pipeline/emf_logs/translator.go +++ b/translator/translate/otel/pipeline/emf_logs/translator.go @@ -4,7 +4,6 @@ package emf_logs import ( - "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/awsentity" "strings" "go.opentelemetry.io/collector/component" @@ -13,6 +12,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awscloudwatchlogs" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/awsentity" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/batchprocessor" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/tcplog" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/udplog" From c8c2babd7e2d241e9855a83c3cd5e07076da28eb Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Mon, 23 Dec 2024 15:56:57 -0500 Subject: [PATCH 3/8] Fix linter errors --- plugins/processors/awsentity/factory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/processors/awsentity/factory.go b/plugins/processors/awsentity/factory.go index 59f7b22c4b..caf4696c87 100644 --- a/plugins/processors/awsentity/factory.go +++ b/plugins/processors/awsentity/factory.go @@ -58,7 +58,7 @@ func createMetricsProcessor( func createLogsProcessor( ctx context.Context, - set processor.CreateSettings, + set processor.Settings, cfg component.Config, nextConsumer consumer.Logs, ) (processor.Logs, error) { From e1d3a905eaa21f5f1dd1440478e74c10e172b3d6 Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Mon, 23 Dec 2024 16:25:02 -0500 Subject: [PATCH 4/8] Fix unit test failures --- .../sampleConfig/base_container_insights_config.yaml | 4 ++++ .../tocwconfig/sampleConfig/complete_darwin_config.yaml | 4 ++++ .../tocwconfig/sampleConfig/complete_linux_config.yaml | 4 ++++ translator/tocwconfig/sampleConfig/config_with_env.yaml | 4 ++++ .../sampleConfig/emf_and_kubernetes_config.yaml | 4 ++++ .../sampleConfig/emf_and_kubernetes_with_gpu_config.yaml | 4 ++++ .../emf_and_kubernetes_with_kueue_config.yaml | 4 ++++ .../sampleConfig/kueue_container_insights_config.yaml | 4 ++++ .../tocwconfig/sampleConfig/log_ecs_metric_only.yaml | 4 ++++ .../sampleConfig/logs_and_kubernetes_config.yaml | 4 ++++ .../translate/otel/pipeline/emf_logs/translator_test.go | 8 ++++---- 11 files changed, 44 insertions(+), 4 deletions(-) diff --git a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml index 4df5992b20..5002e989b6 100644 --- a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml @@ -159,6 +159,9 @@ extensions: mode: ec2 region: us-east-1 processors: + awsentity/service/emf: + entity_type: Service + platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -235,6 +238,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml b/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml index cb9b62b5d7..04253829b9 100644 --- a/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml @@ -105,6 +105,9 @@ processors: awsentity/resource: entity_type: Resource platform: ec2 + awsentity/service/emf: + entity_type: Service + platform: ec2 awsentity/service/telegraf: entity_type: Service platform: ec2 @@ -273,6 +276,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - udplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/complete_linux_config.yaml b/translator/tocwconfig/sampleConfig/complete_linux_config.yaml index 6105f937bc..5ee86838e1 100644 --- a/translator/tocwconfig/sampleConfig/complete_linux_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_linux_config.yaml @@ -111,6 +111,9 @@ processors: awsentity/resource: entity_type: Resource platform: ec2 + awsentity/service/emf: + entity_type: Service + platform: ec2 awsentity/service/telegraf: entity_type: Service platform: ec2 @@ -380,6 +383,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - udplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/config_with_env.yaml b/translator/tocwconfig/sampleConfig/config_with_env.yaml index 40307cc324..82dddd5788 100644 --- a/translator/tocwconfig/sampleConfig/config_with_env.yaml +++ b/translator/tocwconfig/sampleConfig/config_with_env.yaml @@ -50,6 +50,9 @@ extensions: mode: ec2 region: ${ENV_REGION} processors: + awsentity/service/emf: + entity_type: Service + platform: ec2 batch/emf_logs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -92,6 +95,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml index 8a0d8fc3e2..766c73e1fa 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml @@ -411,6 +411,9 @@ extensions: region: us-east-1 shared_credential_file: /root/.aws/credentials processors: + awsentity/service/emf: + entity_type: Service + platform: onPremise batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -499,6 +502,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml index d70f0580c3..961f1ea924 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml @@ -669,6 +669,9 @@ extensions: region: us-east-1 shared_credential_file: /root/.aws/credentials processors: + awsentity/service/emf: + entity_type: Service + platform: onPremise batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -1171,6 +1174,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_kueue_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_kueue_config.yaml index f59e0a6639..31d2db9286 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_kueue_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_kueue_config.yaml @@ -491,6 +491,9 @@ extensions: region: us-east-1 shared_credential_file: /root/.aws/credentials processors: + awsentity/service/emf: + entity_type: Service + platform: onPremise batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -588,6 +591,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/kueue_container_insights_config.yaml b/translator/tocwconfig/sampleConfig/kueue_container_insights_config.yaml index afc2bc77ed..42ff679f8b 100644 --- a/translator/tocwconfig/sampleConfig/kueue_container_insights_config.yaml +++ b/translator/tocwconfig/sampleConfig/kueue_container_insights_config.yaml @@ -237,6 +237,9 @@ extensions: mode: ec2 region: us-east-1 processors: + awsentity/service/emf: + entity_type: Service + platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -322,6 +325,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml index 1b0e0ee4c3..e94a83be73 100644 --- a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml +++ b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml @@ -105,6 +105,9 @@ extensions: mode: EC2 region_type: ACJ processors: + awsentity/service/emf: + entity_type: Service + platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -180,6 +183,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml index 46216e4031..0ff9a6b06d 100644 --- a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml @@ -405,6 +405,9 @@ extensions: mode: ec2 region: us-east-1 processors: + awsentity/service/emf: + entity_type: Service + platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -491,6 +494,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/translate/otel/pipeline/emf_logs/translator_test.go b/translator/translate/otel/pipeline/emf_logs/translator_test.go index 2354ca057e..5ff0b97af3 100644 --- a/translator/translate/otel/pipeline/emf_logs/translator_test.go +++ b/translator/translate/otel/pipeline/emf_logs/translator_test.go @@ -46,7 +46,7 @@ func TestTranslator(t *testing.T) { want: &want{ pipelineType: "logs/emf_logs", receivers: []string{"tcplog/emf_logs", "udplog/emf_logs"}, - processors: []string{"batch/emf_logs"}, + processors: []string{"batch/emf_logs", "awsentity/service/emf"}, exporters: []string{"awscloudwatchlogs/emf_logs"}, extensions: []string{"agenthealth/logs", "agenthealth/statuscode"}, }, @@ -62,7 +62,7 @@ func TestTranslator(t *testing.T) { want: &want{ pipelineType: "logs/emf_logs", receivers: []string{"tcplog/emf_logs", "udplog/emf_logs"}, - processors: []string{"batch/emf_logs"}, + processors: []string{"batch/emf_logs", "awsentity/service/emf"}, exporters: []string{"awscloudwatchlogs/emf_logs"}, extensions: []string{"agenthealth/logs", "agenthealth/statuscode"}, }, @@ -80,7 +80,7 @@ func TestTranslator(t *testing.T) { want: &want{ pipelineType: "logs/emf_logs", receivers: []string{"udplog/emf_logs"}, - processors: []string{"batch/emf_logs"}, + processors: []string{"batch/emf_logs", "awsentity/service/emf"}, exporters: []string{"awscloudwatchlogs/emf_logs"}, extensions: []string{"agenthealth/logs", "agenthealth/statuscode"}, }, @@ -98,7 +98,7 @@ func TestTranslator(t *testing.T) { want: &want{ pipelineType: "logs/emf_logs", receivers: []string{"tcplog/emf_logs"}, - processors: []string{"batch/emf_logs"}, + processors: []string{"batch/emf_logs", "awsentity/service/emf"}, exporters: []string{"awscloudwatchlogs/emf_logs"}, extensions: []string{"agenthealth/logs", "agenthealth/statuscode"}, }, From 6f26408df980ad6aef57fce8d059b286ccaf038d Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Tue, 24 Dec 2024 12:51:51 -0500 Subject: [PATCH 5/8] Remove ECS from translation --- .../tocwconfig/sampleConfig/log_ecs_metric_only.yaml | 4 ---- translator/translate/otel/pipeline/emf_logs/translator.go | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml index e94a83be73..1b0e0ee4c3 100644 --- a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml +++ b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml @@ -105,9 +105,6 @@ extensions: mode: EC2 region_type: ACJ processors: - awsentity/service/emf: - entity_type: Service - platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -183,7 +180,6 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: - - awsentity/service/emf - batch/emf_logs receivers: - tcplog/emf_logs diff --git a/translator/translate/otel/pipeline/emf_logs/translator.go b/translator/translate/otel/pipeline/emf_logs/translator.go index aaecb49e7f..aac7e55318 100644 --- a/translator/translate/otel/pipeline/emf_logs/translator.go +++ b/translator/translate/otel/pipeline/emf_logs/translator.go @@ -4,6 +4,8 @@ package emf_logs import ( + "github.com/aws/amazon-cloudwatch-agent/translator/context" + "github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil" "strings" "go.opentelemetry.io/collector/component" @@ -49,12 +51,15 @@ func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators } translators := common.ComponentTranslators{ Receivers: common.NewTranslatorMap[component.Config](), - Processors: common.NewTranslatorMap(batchprocessor.NewTranslatorWithNameAndSection(common.PipelineNameEmfLogs, common.LogsKey), awsentity.NewTranslatorWithEntityType(awsentity.Service, "emf", false)), // EMF logs sit under metrics_collected in "logs" + Processors: common.NewTranslatorMap(batchprocessor.NewTranslatorWithNameAndSection(common.PipelineNameEmfLogs, common.LogsKey)), // EMF logs sit under metrics_collected in "logs" Exporters: common.NewTranslatorMap(awscloudwatchlogs.NewTranslatorWithName(common.PipelineNameEmfLogs)), Extensions: common.NewTranslatorMap(agenthealth.NewTranslator(component.DataTypeLogs, []string{agenthealth.OperationPutLogEvents}), agenthealth.NewTranslatorWithStatusCode(component.MustNewType("statuscode"), nil, true), ), } + if !(context.CurrentContext().RunInContainer() && ecsutil.GetECSUtilSingleton().IsECS()) { + translators.Processors.Set(awsentity.NewTranslatorWithEntityType(awsentity.Service, "emf", false)) + } if serviceAddress, ok := common.GetString(conf, serviceAddressEMFKey); ok { if strings.Contains(serviceAddress, common.Udp) { translators.Receivers.Set(udplog.NewTranslatorWithName(common.PipelineNameEmfLogs)) From 6d1aea8b66c683f778ff81bfdc93f750f59e5526 Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Tue, 24 Dec 2024 12:53:52 -0500 Subject: [PATCH 6/8] Fix linter errors --- translator/translate/otel/pipeline/emf_logs/translator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translator/translate/otel/pipeline/emf_logs/translator.go b/translator/translate/otel/pipeline/emf_logs/translator.go index aac7e55318..7172e6df98 100644 --- a/translator/translate/otel/pipeline/emf_logs/translator.go +++ b/translator/translate/otel/pipeline/emf_logs/translator.go @@ -4,13 +4,12 @@ package emf_logs import ( - "github.com/aws/amazon-cloudwatch-agent/translator/context" - "github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil" "strings" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" + "github.com/aws/amazon-cloudwatch-agent/translator/context" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awscloudwatchlogs" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" @@ -18,6 +17,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/batchprocessor" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/tcplog" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/udplog" + "github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil" ) var ( From eeb04d7ef87b3afcccdf99b02d838d98ca1b0132 Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Tue, 24 Dec 2024 13:17:52 -0500 Subject: [PATCH 7/8] Fix factory unit test --- plugins/processors/awsentity/factory_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/processors/awsentity/factory_test.go b/plugins/processors/awsentity/factory_test.go index a00799bc55..e98c61b26d 100644 --- a/plugins/processors/awsentity/factory_test.go +++ b/plugins/processors/awsentity/factory_test.go @@ -40,6 +40,6 @@ func TestCreateProcessor(t *testing.T) { assert.NotNil(t, mProcessor) lProcessor, err := factory.CreateLogsProcessor(context.Background(), setting, cfg, consumertest.NewNop()) - assert.Equal(t, err, component.ErrDataTypeIsNotSupported) - assert.Nil(t, lProcessor) + assert.NoError(t, err) + assert.NotNil(t, lProcessor) } From 9a899389940c6528a4cf1b43dbfac54e7eed6f5a Mon Sep 17 00:00:00 2001 From: Zhihong Lin Date: Tue, 24 Dec 2024 13:42:22 -0500 Subject: [PATCH 8/8] Fix windows unit test --- .../tocwconfig/sampleConfig/complete_windows_config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/translator/tocwconfig/sampleConfig/complete_windows_config.yaml b/translator/tocwconfig/sampleConfig/complete_windows_config.yaml index e7fa12f152..0a7fb5c98f 100644 --- a/translator/tocwconfig/sampleConfig/complete_windows_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_windows_config.yaml @@ -105,6 +105,9 @@ processors: awsentity/resource: entity_type: Resource platform: ec2 + awsentity/service/emf: + entity_type: Service + platform: ec2 awsentity/service/telegraf: entity_type: Service platform: ec2 @@ -260,6 +263,7 @@ service: exporters: - awscloudwatchlogs/emf_logs processors: + - awsentity/service/emf - batch/emf_logs receivers: - udplog/emf_logs