Skip to content

Commit

Permalink
Revert "[processor/awsentity] Add awsentity processor into EMF pipeli…
Browse files Browse the repository at this point in the history
…ne (#1482)"

This reverts commit dfd2070.
  • Loading branch information
zhihonl committed Jan 7, 2025
1 parent 07361c7 commit d9a1bc6
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 80 deletions.
24 changes: 1 addition & 23 deletions plugins/processors/awsentity/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ func NewFactory() processor.Factory {
return processor.NewFactory(
TypeStr,
createDefaultConfig,
processor.WithMetrics(createMetricsProcessor, stability),
processor.WithLogs(createLogsProcessor, stability),
)
processor.WithMetrics(createMetricsProcessor, stability))
}

func createDefaultConfig() component.Config {
Expand All @@ -55,23 +53,3 @@ func createMetricsProcessor(
metricsProcessor.processMetrics,
processorhelper.WithCapabilities(processorCapabilities))
}

func createLogsProcessor(
ctx context.Context,
set processor.Settings,
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))
}
4 changes: 2 additions & 2 deletions plugins/processors/awsentity/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ func TestCreateProcessor(t *testing.T) {
assert.NotNil(t, mProcessor)

lProcessor, err := factory.CreateLogsProcessor(context.Background(), setting, cfg, consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, lProcessor)
assert.Equal(t, err, component.ErrDataTypeIsNotSupported)
assert.Nil(t, lProcessor)
}
5 changes: 0 additions & 5 deletions plugins/processors/awsentity/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"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"
Expand Down Expand Up @@ -111,10 +110,6 @@ 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ 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
Expand Down Expand Up @@ -238,7 +235,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ processors:
awsentity/resource:
entity_type: Resource
platform: ec2
awsentity/service/emf:
entity_type: Service
platform: ec2
awsentity/service/telegraf:
entity_type: Service
platform: ec2
Expand Down Expand Up @@ -276,7 +273,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- udplog/emf_logs
Expand Down
4 changes: 0 additions & 4 deletions translator/tocwconfig/sampleConfig/complete_linux_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ processors:
awsentity/resource:
entity_type: Resource
platform: ec2
awsentity/service/emf:
entity_type: Service
platform: ec2
awsentity/service/telegraf:
entity_type: Service
platform: ec2
Expand Down Expand Up @@ -383,7 +380,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- udplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ processors:
awsentity/resource:
entity_type: Resource
platform: ec2
awsentity/service/emf:
entity_type: Service
platform: ec2
awsentity/service/telegraf:
entity_type: Service
platform: ec2
Expand Down Expand Up @@ -263,7 +260,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- udplog/emf_logs
Expand Down
4 changes: 0 additions & 4 deletions translator/tocwconfig/sampleConfig/config_with_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ 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
Expand Down Expand Up @@ -95,7 +92,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ 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
Expand Down Expand Up @@ -502,7 +499,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,6 @@ 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
Expand Down Expand Up @@ -1174,7 +1171,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,6 @@ 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
Expand Down Expand Up @@ -591,7 +588,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ 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
Expand Down Expand Up @@ -325,7 +322,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,6 @@ 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
Expand Down Expand Up @@ -494,7 +491,6 @@ service:
exporters:
- awscloudwatchlogs/emf_logs
processors:
- awsentity/service/emf
- batch/emf_logs
receivers:
- tcplog/emf_logs
Expand Down
6 changes: 0 additions & 6 deletions translator/translate/otel/pipeline/emf_logs/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import (
"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"
"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"
"github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil"
)

var (
Expand Down Expand Up @@ -57,9 +54,6 @@ func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators
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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", "awsentity/service/emf"},
processors: []string{"batch/emf_logs"},
exporters: []string{"awscloudwatchlogs/emf_logs"},
extensions: []string{"agenthealth/logs", "agenthealth/statuscode"},
},
Expand All @@ -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", "awsentity/service/emf"},
processors: []string{"batch/emf_logs"},
exporters: []string{"awscloudwatchlogs/emf_logs"},
extensions: []string{"agenthealth/logs", "agenthealth/statuscode"},
},
Expand All @@ -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", "awsentity/service/emf"},
processors: []string{"batch/emf_logs"},
exporters: []string{"awscloudwatchlogs/emf_logs"},
extensions: []string{"agenthealth/logs", "agenthealth/statuscode"},
},
Expand All @@ -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", "awsentity/service/emf"},
processors: []string{"batch/emf_logs"},
exporters: []string{"awscloudwatchlogs/emf_logs"},
extensions: []string{"agenthealth/logs", "agenthealth/statuscode"},
},
Expand Down

0 comments on commit d9a1bc6

Please sign in to comment.