From e6aea1dbaea2c1c90f1eae66e8559e3d8fc77442 Mon Sep 17 00:00:00 2001 From: Raj Nishtala Date: Thu, 19 Dec 2024 10:49:06 -0500 Subject: [PATCH] Add test to validate the attributes processor --- .../opampextension/opamp_agent_test.go | 1 + .../opamp.d/opamp-attributes-processor.yaml | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 pkg/extension/opampextension/testdata/opamp.d/opamp-attributes-processor.yaml diff --git a/pkg/extension/opampextension/opamp_agent_test.go b/pkg/extension/opampextension/opamp_agent_test.go index 9a2e8b4ac7..346b6f87e0 100644 --- a/pkg/extension/opampextension/opamp_agent_test.go +++ b/pkg/extension/opampextension/opamp_agent_test.go @@ -71,6 +71,7 @@ func TestApplyRemoteConfig(t *testing.T) { {"ApplyKafkaMetricsConfig", "testdata/opamp.d/opamp-kafkametrics-config.yaml", false, ""}, {"ApplyElasticsearchConfig", "testdata/opamp.d/opamp-elastic-config.yaml", false, ""}, {"ApplyMysqlConfig", "testdata/opamp.d/opamp-mysql-config.yaml", false, ""}, + {"ApplyattributesprocessorConfig", "testdata/opamp.d/opamp-attributes-processor.yaml", false, ""}, {"ApplyPostgresqlConfig", "testdata/opamp.d/opamp-postgresql-config.yaml", false, ""}, {"ApplyRabbitmqConfig", "testdata/opamp.d/opamp-rabbitmq-config.yaml", false, ""}, {"ApplyRedisConfig", "testdata/opamp.d/opamp-redis-config.yaml", false, ""}, diff --git a/pkg/extension/opampextension/testdata/opamp.d/opamp-attributes-processor.yaml b/pkg/extension/opampextension/testdata/opamp.d/opamp-attributes-processor.yaml new file mode 100644 index 0000000000..5bdf8cc184 --- /dev/null +++ b/pkg/extension/opampextension/testdata/opamp.d/opamp-attributes-processor.yaml @@ -0,0 +1,45 @@ +receivers: + mysql: + endpoint: localhost:3306 + username: otel + password: test + database: otel + collection_interval: 10s + initial_delay: 1s + statement_events: + digest_text_limit: 120 + time_limit: 24h + limit: 250 +exporters: + sumologic: +processors: + attributes/example: + actions: + - key: db.table + action: delete + - key: redacted_span + value: true + action: upsert + - key: copy_key + from_attribute: key_original + action: update + - key: account_id + value: 2245 + action: insert + - key: account_password + action: delete + - key: account_email + action: hash + - key: http.status_code + action: convert + converted_type: int + +service: + pipelines: + metrics/mysql/09c98ea4-6686-4ab9-b3cd-f04070906441: + processors: + - attributes/example + receivers: + - mysql + exporters: + - sumologic