diff --git a/docs/contributor/otel-bump-guide.md b/docs/contributor/otel-bump-guide.md index 2d20b83651..2fc0b79217 100644 --- a/docs/contributor/otel-bump-guide.md +++ b/docs/contributor/otel-bump-guide.md @@ -4,14 +4,16 @@ As a maintainer or contributor, follow these steps to update the `opentelemetry- ## Table of Content +- [OpenTelemetry Dependency Bump Guide](#opentelemetry-dependency-bump-guide) + - [Table of Content](#table-of-content) - [Preparation](#preparation) - - [Review Changed Components](#1-review-changed-components) - - [Detect OTTL Changes](#2-detect-ottl-changes) - - [Review Processor Updates](#3-review-processor-updates) - - [Check Internal Metrics](#4-check-internal-metrics) - - [Identify and Plan for Breaking Changes](#5-identify-and-plan-for-breaking-changes) + - [1. Review Changed Components](#1-review-changed-components) + - [2. Detect OTTL Changes](#2-detect-ottl-changes) + - [3. Review Processor Updates](#3-review-processor-updates) + - [4. Check Internal Metrics](#4-check-internal-metrics) + - [5. Identify and Plan for Breaking Changes](#5-identify-and-plan-for-breaking-changes) - [Implementation](#implementation) - - [Post Bump Verification](#post-bump-verification) + - [Post-Bump Verification](#post-bump-verification) ## Preparation @@ -36,7 +38,6 @@ Identify breaking changes, bug fixes, and enhancements for the following compone - `filterprocessor` (contrib) - `k8sattributesprocessor` (contrib) - `memorylimiterprocessor` - - `resourceprocessor` (contrib) - `transformprocessor` (contrib) - Exporters - `otlpexporter` diff --git a/internal/otelcollector/config/common/constants.go b/internal/otelcollector/config/common/constants.go index fa9907e990..7ec5ff946a 100644 --- a/internal/otelcollector/config/common/constants.go +++ b/internal/otelcollector/config/common/constants.go @@ -117,14 +117,14 @@ const ( ComponentIDSetInstrumentationScopeKymaProcessor = "transform/set-instrumentation-scope-kyma" ComponentIDSetInstrumentationScopeRuntimeProcessor = "transform/set-instrumentation-scope-runtime" ComponentIDUserDefinedTransformProcessor = "transform/user-defined-%s" // dynamically filled with pipeline name - ComponentIDInsertClusterAttributesProcessor = "resource/insert-cluster-attributes" - ComponentIDDropKymaAttributesProcessor = "resource/drop-kyma-attributes" + ComponentIDInsertClusterAttributesProcessor = "transform/insert-cluster-attributes" + ComponentIDDropKymaAttributesProcessor = "transform/drop-kyma-attributes" - ComponentIDSetKymaInputNameRuntimeProcessor ComponentID = "resource/set-kyma-input-name-runtime" - ComponentIDSetKymaInputNameIstioProcessor ComponentID = "resource/set-kyma-input-name-istio" - ComponentIDSetKymaInputNamePrometheusProcessor ComponentID = "resource/set-kyma-input-name-prometheus" - ComponentIDSetKymaInputNameKymaProcessor ComponentID = "resource/set-kyma-input-name-kyma" - ComponentIDSetKymaInputNameOTLPProcessor ComponentID = "resource/set-kyma-input-name-otlp" + ComponentIDSetKymaInputNameRuntimeProcessor ComponentID = "transform/set-kyma-input-name-runtime" + ComponentIDSetKymaInputNameIstioProcessor ComponentID = "transform/set-kyma-input-name-istio" + ComponentIDSetKymaInputNamePrometheusProcessor ComponentID = "transform/set-kyma-input-name-prometheus" + ComponentIDSetKymaInputNameKymaProcessor ComponentID = "transform/set-kyma-input-name-kyma" + ComponentIDSetKymaInputNameOTLPProcessor ComponentID = "transform/set-kyma-input-name-otlp" // Log-Specific Processors @@ -152,8 +152,8 @@ const ( ComponentIDDropIstioDiagnosticMetricsProcessor = "filter/drop-diagnostic-metrics-if-input-source-istio" ComponentIDFilterDropNonPVCVolumesMetricsProcessor = "filter/drop-non-pvc-volumes-metrics" ComponentIDFilterDropVirtualNetworkInterfacesProcessor = "filter/drop-virtual-network-interfaces" - ComponentIDResourceDropServiceNameProcessor = "resource/drop-service-name" - ComponentIDDropSkipEnrichmentAttributeProcessor = "resource/drop-skip-enrichment-attribute" + ComponentIDDropServiceNameProcessor = "transform/drop-service-name" + ComponentIDDropSkipEnrichmentAttributeProcessor = "transform/drop-skip-enrichment-attribute" ComponentIDSetInstrumentationScopePrometheusProcessor = "transform/set-instrumentation-scope-prometheus" ComponentIDSetInstrumentationScopeIstioProcessor = "transform/set-instrumentation-scope-istio" ComponentIDInsertSkipEnrichmentAttributeProcessor = "transform/insert-skip-enrichment-attribute" diff --git a/internal/otelcollector/config/common/processor_builders.go b/internal/otelcollector/config/common/processor_builders.go index ce3e37e091..3e60caeab9 100644 --- a/internal/otelcollector/config/common/processor_builders.go +++ b/internal/otelcollector/config/common/processor_builders.go @@ -108,58 +108,6 @@ func extractPodLabels(enrichments *operatorv1alpha1.EnrichmentSpec) []ExtractLab // RESOURCE PROCESSOR BUILDERS // ============================================================================= -// InsertClusterAttributesProcessorConfig creates a resource processor that inserts cluster attributes -func InsertClusterAttributesProcessorConfig(clusterName, clusterUID, cloudProvider string) *ResourceProcessor { - if cloudProvider != "" { - return &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: "k8s.cluster.name", - Value: clusterName, - }, - { - Action: AttributeActionInsert, - Key: "k8s.cluster.uid", - Value: clusterUID, - }, - { - Action: AttributeActionInsert, - Key: "cloud.provider", - Value: cloudProvider, - }, - }, - } - } - - return &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: "k8s.cluster.name", - Value: clusterName, - }, - { - Action: AttributeActionInsert, - Key: "k8s.cluster.uid", - Value: clusterUID, - }, - }, - } -} - -// DropKymaAttributesProcessorConfig creates a resource processor that drops Kyma attributes -func DropKymaAttributesProcessorConfig() *ResourceProcessor { - return &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionDelete, - RegexPattern: "kyma.*", - }, - }, - } -} - // ResolveServiceNameConfig creates a service enrichment processor configuration func ResolveServiceNameConfig() *ServiceEnrichmentProcessor { return &ServiceEnrichmentProcessor{ @@ -285,6 +233,38 @@ func TransformSpecsToProcessorStatements(specs []telemetryv1alpha1.TransformSpec return result } +type ClusterOptions struct { + ClusterName string + ClusterUID string + CloudProvider string +} + +// InsertClusterAttributesProcessorStatements creates processor statements for the transform processor that inserts cluster attributes +func InsertClusterAttributesProcessorStatements(cluster ClusterOptions) []TransformProcessorStatements { + statements := []string{ + fmt.Sprintf("set(resource.attributes[\"k8s.cluster.name\"], \"%s\")", cluster.ClusterName), + fmt.Sprintf("set(resource.attributes[\"k8s.cluster.uid\"], \"%s\")", cluster.ClusterUID), + } + + if cluster.CloudProvider != "" { + statements = append(statements, + fmt.Sprintf("set(resource.attributes[\"cloud.provider\"], \"%s\")", cluster.CloudProvider)) + } + + return []TransformProcessorStatements{{ + Statements: statements, + }} +} + +// DropKymaAttributesProcessorStatements creates processor statements for the transform processor that drops Kyma attributes +func DropKymaAttributesProcessorStatements() []TransformProcessorStatements { + return []TransformProcessorStatements{{ + Statements: []string{ + "delete_matching_keys(resource.attributes, \"kyma.*\")", + }, + }} +} + // InstrumentationScopeProcessorConfig creates a transform processor for instrumentation scope func InstrumentationScopeProcessorConfig(instrumentationScopeVersion string, inputSource ...InputSourceType) *TransformProcessor { statements := []string{} @@ -301,20 +281,14 @@ func InstrumentationScopeProcessorConfig(instrumentationScopeVersion string, inp return MetricTransformProcessorConfig(transformProcessorStatements) } -// KymaInputNameProcessorConfig creates a transform processor that sets the custom `kyma.input.name` attribute +// KymaInputNameProcessorStatements creates processor statements for the transform processor that sets the custom `kyma.input.name` attribute // the attribute is mainly used for routing purpose in the metric agent configuration -func KymaInputNameProcessorConfig(inputSource InputSourceType) *ResourceProcessor { - resourceProcessor := ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(inputSource), - }, +func KymaInputNameProcessorStatements(inputSource InputSourceType) []TransformProcessorStatements { + return []TransformProcessorStatements{{ + Statements: []string{ + fmt.Sprintf("set(resource.attributes[\"%s\"], \"%s\")", KymaInputNameAttribute, string(inputSource)), }, - } - - return &resourceProcessor + }} } func instrumentationStatement(inputSource InputSourceType, instrumentationScopeVersion string) []string { diff --git a/internal/otelcollector/config/common/processor_builders_test.go b/internal/otelcollector/config/common/processor_builders_test.go index 79a720d0bd..64d6b18024 100644 --- a/internal/otelcollector/config/common/processor_builders_test.go +++ b/internal/otelcollector/config/common/processor_builders_test.go @@ -9,45 +9,61 @@ import ( operatorv1alpha1 "github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1" ) -func TestInsertClusterNameProcessorConfig(t *testing.T) { +func TestInsertClusterAttributesProcessorStatements(t *testing.T) { require := require.New(t) - expectedAttributeActions := []AttributeAction{ - { - Action: AttributeActionInsert, - Key: "k8s.cluster.name", - Value: "test-cluster", + expectedProcessorStatements := []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"k8s.cluster.name\"], \"test-cluster\")", + "set(resource.attributes[\"k8s.cluster.uid\"], \"test-cluster-uid\")", + "set(resource.attributes[\"cloud.provider\"], \"test-cloud-provider\")", }, - { - Action: AttributeActionInsert, - Key: "k8s.cluster.uid", - Value: "test-cluster-uid", + }} + + processorStatements := InsertClusterAttributesProcessorStatements( + ClusterOptions{ + ClusterName: "test-cluster", + ClusterUID: "test-cluster-uid", + CloudProvider: "test-cloud-provider", }, - { - Action: AttributeActionInsert, - Key: "cloud.provider", - Value: "test-cloud-provider", + ) + + require.ElementsMatch(expectedProcessorStatements, processorStatements, "Attributes should match") +} + +func TestInsertClusterAttributesProcessorStatementsWithEmptyValues(t *testing.T) { + require := require.New(t) + + expectedProcessorStatements := []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"k8s.cluster.name\"], \"\")", + "set(resource.attributes[\"k8s.cluster.uid\"], \"\")", }, - } + }} - config := InsertClusterAttributesProcessorConfig("test-cluster", "test-cluster-uid", "test-cloud-provider") + processorStatements := InsertClusterAttributesProcessorStatements( + ClusterOptions{ + ClusterName: "", + ClusterUID: "", + CloudProvider: "", + }, + ) - require.ElementsMatch(expectedAttributeActions, config.Attributes, "Attributes should match") + require.ElementsMatch(expectedProcessorStatements, processorStatements, "Attributes should match") } -func TestDropKymaAttributesProcessorConfig(t *testing.T) { +func TestDropKymaAttributesProcessorStatements(t *testing.T) { require := require.New(t) - expectedAttributeActions := []AttributeAction{ - { - Action: AttributeActionDelete, - RegexPattern: "kyma.*", + expectedProcessorStatements := []TransformProcessorStatements{{ + Statements: []string{ + "delete_matching_keys(resource.attributes, \"kyma.*\")", }, - } + }} - config := DropKymaAttributesProcessorConfig() + processorStatements := DropKymaAttributesProcessorStatements() - require.ElementsMatch(expectedAttributeActions, config.Attributes, "Attributes should match") + require.ElementsMatch(expectedProcessorStatements, processorStatements, "Attributes should match") } func TestTransformedInstrumentationScope(t *testing.T) { @@ -312,7 +328,7 @@ func TestBuildPodLabelEnrichments(t *testing.T) { } } -func TestKymaInputNameProcessorConfig(t *testing.T) { +func TestKymaInputNameProcessorStatements(t *testing.T) { type args struct { inputSource InputSourceType } @@ -320,91 +336,67 @@ func TestKymaInputNameProcessorConfig(t *testing.T) { tests := []struct { name string args args - want *ResourceProcessor + want []TransformProcessorStatements }{ { name: "InputSourceRuntime", args: args{inputSource: InputSourceRuntime}, - want: &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(InputSourceRuntime), - }, + want: []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"kyma.input.name\"], \"runtime\")", }, - }, + }}, }, { name: "InputSourcePrometheus", args: args{inputSource: InputSourcePrometheus}, - want: &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(InputSourcePrometheus), - }, + want: []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"kyma.input.name\"], \"prometheus\")", }, - }, + }}, }, { name: "InputSourceIstio", args: args{inputSource: InputSourceIstio}, - want: &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(InputSourceIstio), - }, + want: []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"kyma.input.name\"], \"istio\")", }, - }, + }}, }, { name: "InputSourceOTLP", args: args{inputSource: InputSourceOTLP}, - want: &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(InputSourceOTLP), - }, + want: []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"kyma.input.name\"], \"otlp\")", }, - }, + }}, }, { name: "InputSourceKyma", args: args{inputSource: InputSourceKyma}, - want: &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(InputSourceKyma), - }, + want: []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"kyma.input.name\"], \"kyma\")", }, - }, + }}, }, { name: "InputSourceK8sCluster", args: args{inputSource: InputSourceK8sCluster}, - want: &ResourceProcessor{ - Attributes: []AttributeAction{ - { - Action: AttributeActionInsert, - Key: KymaInputNameAttribute, - Value: string(InputSourceK8sCluster), - }, + want: []TransformProcessorStatements{{ + Statements: []string{ + "set(resource.attributes[\"kyma.input.name\"], \"k8s_cluster\")", }, - }, + }}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := KymaInputNameProcessorConfig(tt.args.inputSource); !reflect.DeepEqual(got, tt.want) { - t.Errorf("KymaInputNameProcessorConfig() = %v, want %v", got, tt.want) + if got := KymaInputNameProcessorStatements(tt.args.inputSource); !reflect.DeepEqual(got, tt.want) { + t.Errorf("KymaInputNameProcessorStatements() = %v, want %v", got, tt.want) } }) } diff --git a/internal/otelcollector/config/common/types.go b/internal/otelcollector/config/common/types.go index 5cb2ff17cb..1facc025a9 100644 --- a/internal/otelcollector/config/common/types.go +++ b/internal/otelcollector/config/common/types.go @@ -178,17 +178,6 @@ type PodAssociation struct { Name string `yaml:"name,omitempty"` } -type ResourceProcessor struct { - Attributes []AttributeAction `yaml:"attributes"` -} - -type AttributeAction struct { - Action string `yaml:"action,omitempty"` - Key string `yaml:"key,omitempty"` - Value string `yaml:"value,omitempty"` - RegexPattern string `yaml:"pattern,omitempty"` -} - type TransformProcessor struct { ErrorMode string `yaml:"error_mode"` LogStatements []TransformProcessorStatements `yaml:"log_statements,omitempty"` diff --git a/internal/otelcollector/config/logagent/config_builder.go b/internal/otelcollector/config/logagent/config_builder.go index b35058b8e7..9f90654a47 100644 --- a/internal/otelcollector/config/logagent/config_builder.go +++ b/internal/otelcollector/config/logagent/config_builder.go @@ -25,11 +25,9 @@ type Builder struct { } type BuildOptions struct { + Cluster common.ClusterOptions InstrumentationScopeVersion string AgentNamespace string - ClusterName string - ClusterUID string - CloudProvider string Enrichments *operatorv1alpha1.EnrichmentSpec } @@ -114,7 +112,8 @@ func (b *Builder) addInsertClusterAttributesProcessor(opts BuildOptions) buildCo return b.AddProcessor( b.StaticComponentID(common.ComponentIDInsertClusterAttributesProcessor), func(lp *telemetryv1alpha1.LogPipeline) any { - return common.InsertClusterAttributesProcessorConfig(opts.ClusterName, opts.ClusterUID, opts.CloudProvider) + transformStatements := common.InsertClusterAttributesProcessorStatements(opts.Cluster) + return common.LogTransformProcessorConfig(transformStatements) }, ) } @@ -132,7 +131,8 @@ func (b *Builder) addDropKymaAttributesProcessor() buildComponentFunc { return b.AddProcessor( b.StaticComponentID(common.ComponentIDDropKymaAttributesProcessor), func(lp *telemetryv1alpha1.LogPipeline) any { - return common.DropKymaAttributesProcessorConfig() + transformStatements := common.DropKymaAttributesProcessorStatements() + return common.LogTransformProcessorConfig(transformStatements) }, ) } @@ -146,9 +146,8 @@ func (b *Builder) addUserDefinedTransformProcessor() buildComponentFunc { } transformStatements := common.TransformSpecsToProcessorStatements(lp.Spec.Transforms) - transformProcessor := common.LogTransformProcessorConfig(transformStatements) - return transformProcessor + return common.LogTransformProcessorConfig(transformStatements) }, ) } diff --git a/internal/otelcollector/config/logagent/config_builder_test.go b/internal/otelcollector/config/logagent/config_builder_test.go index 6f55325b2b..11c4ccdc7e 100644 --- a/internal/otelcollector/config/logagent/config_builder_test.go +++ b/internal/otelcollector/config/logagent/config_builder_test.go @@ -9,6 +9,7 @@ import ( "gopkg.in/yaml.v3" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" ) @@ -145,10 +146,12 @@ func TestBuildConfig(t *testing.T) { } buildOptions := BuildOptions{ + Cluster: common.ClusterOptions{ + ClusterName: "test-cluster", + CloudProvider: "azure", + }, InstrumentationScopeVersion: "main", AgentNamespace: "kyma-system", - CloudProvider: "azure", - ClusterName: "test-cluster", } for _, tt := range tests { diff --git a/internal/otelcollector/config/logagent/testdata/http-protocol-with-custom-path.yaml b/internal/otelcollector/config/logagent/testdata/http-protocol-with-custom-path.yaml index 9616f4c052..1c530875f5 100644 --- a/internal/otelcollector/config/logagent/testdata/http-protocol-with-custom-path.yaml +++ b/internal/otelcollector/config/logagent/testdata/http-protocol-with-custom-path.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes exporters: - otlphttp/test telemetry: @@ -200,24 +200,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/http-protocol-without-custom-path.yaml b/internal/otelcollector/config/logagent/testdata/http-protocol-without-custom-path.yaml index 21fec9f791..b0d3428bde 100644 --- a/internal/otelcollector/config/logagent/testdata/http-protocol-without-custom-path.yaml +++ b/internal/otelcollector/config/logagent/testdata/http-protocol-without-custom-path.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes exporters: - otlphttp/test telemetry: @@ -200,24 +200,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-excluded.yaml b/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-excluded.yaml index 356c60463e..b59d4da5cc 100644 --- a/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-excluded.yaml +++ b/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-excluded.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes exporters: - otlp/test telemetry: @@ -199,24 +199,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-included.yaml b/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-included.yaml index 4c4ee086ac..80e5cd156c 100644 --- a/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-included.yaml +++ b/internal/otelcollector/config/logagent/testdata/single-pipeline-namespace-included.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes exporters: - otlp/test telemetry: @@ -198,24 +198,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/single-pipeline.yaml b/internal/otelcollector/config/logagent/testdata/single-pipeline.yaml index 80723ce033..9586fd9d61 100644 --- a/internal/otelcollector/config/logagent/testdata/single-pipeline.yaml +++ b/internal/otelcollector/config/logagent/testdata/single-pipeline.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes exporters: - otlp/test telemetry: @@ -201,24 +201,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/user-defined-filters.yaml b/internal/otelcollector/config/logagent/testdata/user-defined-filters.yaml index 7582b3104b..367197313f 100644 --- a/internal/otelcollector/config/logagent/testdata/user-defined-filters.yaml +++ b/internal/otelcollector/config/logagent/testdata/user-defined-filters.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - filter/user-defined-test1 exporters: - otlp/test1 @@ -28,9 +28,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - filter/user-defined-test2 exporters: - otlp/test2 @@ -342,24 +342,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/user-defined-transform-filter.yaml b/internal/otelcollector/config/logagent/testdata/user-defined-transform-filter.yaml index 4e41bac0ec..bad9bfed4f 100644 --- a/internal/otelcollector/config/logagent/testdata/user-defined-transform-filter.yaml +++ b/internal/otelcollector/config/logagent/testdata/user-defined-transform-filter.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-test1 - filter/user-defined-test1 exporters: @@ -207,24 +207,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/logagent/testdata/user-defined-transforms.yaml b/internal/otelcollector/config/logagent/testdata/user-defined-transforms.yaml index c9589b0b03..2c54dc2034 100644 --- a/internal/otelcollector/config/logagent/testdata/user-defined-transforms.yaml +++ b/internal/otelcollector/config/logagent/testdata/user-defined-transforms.yaml @@ -15,9 +15,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-test1 exporters: - otlp/test1 @@ -28,9 +28,9 @@ service: - memory_limiter - transform/set-instrumentation-scope-runtime - k8sattributes - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-test2 exporters: - otlp/test2 @@ -332,24 +332,22 @@ processors: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: test-cluster - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: azure service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "test-cluster") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "azure") transform/set-instrumentation-scope-runtime: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/config_builder.go b/internal/otelcollector/config/loggateway/config_builder.go index 670c8aef6d..0f71852f73 100644 --- a/internal/otelcollector/config/loggateway/config_builder.go +++ b/internal/otelcollector/config/loggateway/config_builder.go @@ -22,9 +22,7 @@ type Builder struct { } type BuildOptions struct { - ClusterName string - ClusterUID string - CloudProvider string + Cluster common.ClusterOptions Enrichments *operatorv1alpha1.EnrichmentSpec ModuleVersion string } @@ -157,7 +155,8 @@ func (b *Builder) addInsertClusterAttributesProcessor(opts BuildOptions) buildCo return b.AddProcessor( b.StaticComponentID(common.ComponentIDInsertClusterAttributesProcessor), func(lp *telemetryv1alpha1.LogPipeline) any { - return common.InsertClusterAttributesProcessorConfig(opts.ClusterName, opts.ClusterUID, opts.CloudProvider) + transformStatements := common.InsertClusterAttributesProcessorStatements(opts.Cluster) + return common.LogTransformProcessorConfig(transformStatements) }, ) } @@ -175,7 +174,8 @@ func (b *Builder) addDropKymaAttributesProcessor() buildComponentFunc { return b.AddProcessor( b.StaticComponentID(common.ComponentIDDropKymaAttributesProcessor), func(lp *telemetryv1alpha1.LogPipeline) any { - return common.DropKymaAttributesProcessorConfig() + transformStatements := common.DropKymaAttributesProcessorStatements() + return common.LogTransformProcessorConfig(transformStatements) }, ) } @@ -200,9 +200,8 @@ func (b *Builder) addUserDefinedTransformProcessor() buildComponentFunc { } transformStatements := common.TransformSpecsToProcessorStatements(lp.Spec.Transforms) - transformProcessor := common.LogTransformProcessorConfig(transformStatements) - return transformProcessor + return common.LogTransformProcessorConfig(transformStatements) }, ) } diff --git a/internal/otelcollector/config/loggateway/config_builder_test.go b/internal/otelcollector/config/loggateway/config_builder_test.go index 5c7acfc81d..202d4858d8 100644 --- a/internal/otelcollector/config/loggateway/config_builder_test.go +++ b/internal/otelcollector/config/loggateway/config_builder_test.go @@ -10,6 +10,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" ) @@ -148,8 +149,10 @@ func TestBuildConfig(t *testing.T) { } buildOptions := BuildOptions{ - ClusterName: "${KUBERNETES_SERVICE_HOST}", - CloudProvider: "test-cloud-provider", + Cluster: common.ClusterOptions{ + ClusterName: "${KUBERNETES_SERVICE_HOST}", + CloudProvider: "test-cloud-provider", + }, ModuleVersion: "1.0.0", } diff --git a/internal/otelcollector/config/loggateway/testdata/http-protocol-with-custom-path.yaml b/internal/otelcollector/config/loggateway/testdata/http-protocol-with-custom-path.yaml index 94f4b1a6a5..8fefcc789b 100644 --- a/internal/otelcollector/config/loggateway/testdata/http-protocol-with-custom-path.yaml +++ b/internal/otelcollector/config/loggateway/testdata/http-protocol-with-custom-path.yaml @@ -13,9 +13,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - batch exporters: @@ -94,24 +94,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/http-protocol-without-custom-path.yaml b/internal/otelcollector/config/loggateway/testdata/http-protocol-without-custom-path.yaml index 5b2068fe8c..8eda85896a 100644 --- a/internal/otelcollector/config/loggateway/testdata/http-protocol-without-custom-path.yaml +++ b/internal/otelcollector/config/loggateway/testdata/http-protocol-without-custom-path.yaml @@ -13,9 +13,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - batch exporters: @@ -94,24 +94,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-excluded.yaml b/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-excluded.yaml index 7488cf715a..6119733ccb 100644 --- a/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-excluded.yaml +++ b/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-excluded.yaml @@ -14,9 +14,9 @@ service: - k8sattributes - istio_noise_filter - filter/test-filter-by-namespace - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - batch exporters: @@ -99,24 +99,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-included.yaml b/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-included.yaml index c11977805a..ba3f2b355c 100644 --- a/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-included.yaml +++ b/internal/otelcollector/config/loggateway/testdata/single-pipeline-namespace-included.yaml @@ -14,9 +14,9 @@ service: - k8sattributes - istio_noise_filter - filter/test-filter-by-namespace - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - batch exporters: @@ -99,24 +99,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/single-pipeline-otlp-disabled.yaml b/internal/otelcollector/config/loggateway/testdata/single-pipeline-otlp-disabled.yaml index 741cf4a0de..421575afd7 100644 --- a/internal/otelcollector/config/loggateway/testdata/single-pipeline-otlp-disabled.yaml +++ b/internal/otelcollector/config/loggateway/testdata/single-pipeline-otlp-disabled.yaml @@ -14,9 +14,9 @@ service: - k8sattributes - istio_noise_filter - filter/drop-if-input-source-otlp - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - batch exporters: @@ -99,24 +99,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/single-pipeline.yaml b/internal/otelcollector/config/loggateway/testdata/single-pipeline.yaml index f4b5d52e53..e268a7f8a5 100644 --- a/internal/otelcollector/config/loggateway/testdata/single-pipeline.yaml +++ b/internal/otelcollector/config/loggateway/testdata/single-pipeline.yaml @@ -13,9 +13,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - batch exporters: @@ -94,24 +94,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/user-defined-filters.yaml b/internal/otelcollector/config/loggateway/testdata/user-defined-filters.yaml index 75d702a990..09427b6528 100644 --- a/internal/otelcollector/config/loggateway/testdata/user-defined-filters.yaml +++ b/internal/otelcollector/config/loggateway/testdata/user-defined-filters.yaml @@ -13,9 +13,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - filter/user-defined-test1 - batch @@ -29,9 +29,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - filter/user-defined-test2 - batch @@ -121,24 +121,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/user-defined-transform-filter.yaml b/internal/otelcollector/config/loggateway/testdata/user-defined-transform-filter.yaml index 2e2f24c880..7574ac900b 100644 --- a/internal/otelcollector/config/loggateway/testdata/user-defined-transform-filter.yaml +++ b/internal/otelcollector/config/loggateway/testdata/user-defined-transform-filter.yaml @@ -13,9 +13,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - transform/user-defined-test1 - filter/user-defined-test1 @@ -101,24 +101,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/loggateway/testdata/user-defined-transforms.yaml b/internal/otelcollector/config/loggateway/testdata/user-defined-transforms.yaml index 2635f8861d..6d65d0dcb5 100644 --- a/internal/otelcollector/config/loggateway/testdata/user-defined-transforms.yaml +++ b/internal/otelcollector/config/loggateway/testdata/user-defined-transforms.yaml @@ -13,9 +13,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - transform/user-defined-test1 - batch @@ -29,9 +29,9 @@ service: - transform/set-observed-time-if-zero - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - istio_enrichment - transform/user-defined-test2 - batch @@ -111,24 +111,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + log_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + log_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-observed-time-if-zero: error_mode: ignore log_statements: diff --git a/internal/otelcollector/config/metricagent/config_builder.go b/internal/otelcollector/config/metricagent/config_builder.go index 48186f9be6..88d5d37e23 100644 --- a/internal/otelcollector/config/metricagent/config_builder.go +++ b/internal/otelcollector/config/metricagent/config_builder.go @@ -27,14 +27,13 @@ type Builder struct { } type BuildOptions struct { + Cluster common.ClusterOptions + // IstioActive indicates whether Istio is installed in the cluster. IstioActive bool IstioCertPath string InstrumentationScopeVersion string AgentNamespace string - ClusterName string - ClusterUID string - CloudProvider string Enrichments *operatorv1alpha1.EnrichmentSpec } @@ -303,9 +302,10 @@ func (b *Builder) addFilterDropVirtualNetworkInterfacesProcessor() buildComponen // The Prometheus receiver sets the service.name attribute by default to the scrape job name, // which prevents it from being enriched by the service name processor. We currently remove it here, // but we should investigate configuring the receiver to not set this attribute in the first place. +// (4 Dec. 2025, TeodorSAP): No solution found yet. func (b *Builder) addDropServiceNameProcessor() buildComponentFunc { return b.AddProcessor( - b.StaticComponentID(common.ComponentIDResourceDropServiceNameProcessor), + b.StaticComponentID(common.ComponentIDDropServiceNameProcessor), func(mp *telemetryv1alpha1.MetricPipeline) any { return dropServiceNameProcessorConfig() }, @@ -343,7 +343,8 @@ func (b *Builder) addSetKymaInputNameProcessor(inputSource common.InputSourceTyp return b.AddProcessor( b.StaticComponentID(common.InputName[inputSource]), func(mp *telemetryv1alpha1.MetricPipeline) any { - return common.KymaInputNameProcessorConfig(inputSource) + transformStatements := common.KymaInputNameProcessorStatements(inputSource) + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -392,9 +393,8 @@ func (b *Builder) addInsertClusterAttributesProcessor(opts BuildOptions) buildCo return b.AddProcessor( b.StaticComponentID(common.ComponentIDInsertClusterAttributesProcessor), func(tp *telemetryv1alpha1.MetricPipeline) any { - return common.InsertClusterAttributesProcessorConfig( - opts.ClusterName, opts.ClusterUID, opts.CloudProvider, - ) + transformStatements := common.InsertClusterAttributesProcessorStatements(opts.Cluster) + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -403,14 +403,13 @@ func (b *Builder) addDropSkipEnrichmentAttributeProcessor() buildComponentFunc { return b.AddProcessor( b.StaticComponentID(common.ComponentIDDropSkipEnrichmentAttributeProcessor), func(mp *telemetryv1alpha1.MetricPipeline) any { - return &common.ResourceProcessor{ - Attributes: []common.AttributeAction{ - { - Action: common.AttributeActionDelete, - Key: common.SkipEnrichmentAttribute, - }, + transformStatements := []common.TransformProcessorStatements{{ + Statements: []string{ + "delete_key(resource.attributes, \"io.kyma-project.telemetry.skip_enrichment\")", }, - } + }} + + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -419,7 +418,8 @@ func (b *Builder) addDropKymaAttributesProcessor() buildComponentFunc { return b.AddProcessor( b.StaticComponentID(common.ComponentIDDropKymaAttributesProcessor), func(mp *telemetryv1alpha1.MetricPipeline) any { - return common.DropKymaAttributesProcessorConfig() + transformStatements := common.DropKymaAttributesProcessorStatements() + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -433,9 +433,8 @@ func (b *Builder) addUserDefinedTransformProcessor() buildComponentFunc { } transformStatements := common.TransformSpecsToProcessorStatements(mp.Spec.Transforms) - transformProcessor := common.MetricTransformProcessorConfig(transformStatements) - return transformProcessor + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -1078,15 +1077,14 @@ func shouldFilterByNamespace(namespaceSelector *telemetryv1alpha1.NamespaceSelec // Processor configuration functions (merged from processors.go) -func dropServiceNameProcessorConfig() *common.ResourceProcessor { - return &common.ResourceProcessor{ - Attributes: []common.AttributeAction{ - { - Action: "delete", - Key: "service.name", +func dropServiceNameProcessorConfig() *common.TransformProcessor { + return common.MetricTransformProcessorConfig( + []common.TransformProcessorStatements{{ + Statements: []string{ + "delete_key(resource.attributes, \"service.name\")", }, - }, - } + }}, + ) } func insertSkipEnrichmentAttributeProcessorConfig() *common.TransformProcessor { diff --git a/internal/otelcollector/config/metricagent/testdata/http-with-custom-path.yaml b/internal/otelcollector/config/metricagent/testdata/http-with-custom-path.yaml index 01d0c9f237..80c0fc4dbc 100644 --- a/internal/otelcollector/config/metricagent/testdata/http-with-custom-path.yaml +++ b/internal/otelcollector/config/metricagent/testdata/http-with-custom-path.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlphttp/test @@ -190,33 +190,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -236,6 +234,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlphttp/test: metrics_endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/http-without-custom-path.yaml b/internal/otelcollector/config/metricagent/testdata/http-without-custom-path.yaml index b6ba74776a..b7e4760b80 100644 --- a/internal/otelcollector/config/metricagent/testdata/http-without-custom-path.yaml +++ b/internal/otelcollector/config/metricagent/testdata/http-without-custom-path.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlphttp/test @@ -190,33 +190,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -236,6 +234,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlphttp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-diagnostic.yaml b/internal/otelcollector/config/metricagent/testdata/istio-diagnostic.yaml index 23712cfc42..4663225bd7 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-diagnostic.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-diagnostic.yaml @@ -21,10 +21,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/output-test: @@ -33,9 +33,9 @@ service: - routing/istio-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -140,39 +140,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-istio: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/istio") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-envoy.yaml b/internal/otelcollector/config/metricagent/testdata/istio-envoy.yaml index 72113f8889..3915daef20 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-envoy.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-envoy.yaml @@ -21,10 +21,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/output-test: @@ -33,9 +33,9 @@ service: - routing/istio-input processors: - filter/drop-diagnostic-metrics-if-input-source-istio - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -140,39 +140,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-istio: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/istio") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-installed-and-disabled.yaml b/internal/otelcollector/config/metricagent/testdata/istio-installed-and-disabled.yaml index 45734e757d..cd71398208 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-installed-and-disabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-installed-and-disabled.yaml @@ -23,9 +23,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/input-runtime: @@ -36,10 +36,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -50,9 +50,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-prometheus - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -363,38 +363,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -420,6 +413,16 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-installed-and-enabled.yaml b/internal/otelcollector/config/metricagent/testdata/istio-installed-and-enabled.yaml index 047bcf97b6..dbb77d911b 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-installed-and-enabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-installed-and-enabled.yaml @@ -23,10 +23,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/input-prometheus: @@ -35,9 +35,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/input-runtime: @@ -48,10 +48,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -63,9 +63,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-prometheus - filter/drop-diagnostic-metrics-if-input-source-istio - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -406,43 +406,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -474,6 +462,21 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-namespace-filters.yaml b/internal/otelcollector/config/metricagent/testdata/istio-namespace-filters.yaml index 52c820c023..0204d21b9e 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-namespace-filters.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-namespace-filters.yaml @@ -21,10 +21,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/output-test: @@ -35,9 +35,9 @@ service: - filter/drop-diagnostic-metrics-if-input-source-istio - filter/drop-envoy-metrics-if-disabled - filter/test-filter-by-namespace-istio-input - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -153,39 +153,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-istio: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/istio") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-disabled.yaml b/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-disabled.yaml index 27a0caa661..b3ad2c0b7b 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-disabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-disabled.yaml @@ -23,9 +23,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/input-runtime: @@ -36,10 +36,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -50,9 +50,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-prometheus - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -307,38 +307,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -364,6 +357,16 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-enabled.yaml b/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-enabled.yaml index 46bea93ddd..4acc2a06ca 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-enabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-not-installed-and-enabled.yaml @@ -23,10 +23,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/input-prometheus: @@ -35,9 +35,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/input-runtime: @@ -48,10 +48,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -63,9 +63,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-prometheus - filter/drop-diagnostic-metrics-if-input-source-istio - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -350,43 +350,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -418,6 +406,21 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/istio-only.yaml b/internal/otelcollector/config/metricagent/testdata/istio-only.yaml index 8f7d050511..5fedca213f 100644 --- a/internal/otelcollector/config/metricagent/testdata/istio-only.yaml +++ b/internal/otelcollector/config/metricagent/testdata/istio-only.yaml @@ -21,10 +21,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/output-test: @@ -34,9 +34,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-istio - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -146,39 +146,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-istio: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/istio") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/multiple-inputs-mixed.yaml b/internal/otelcollector/config/metricagent/testdata/multiple-inputs-mixed.yaml index daeef21cdf..eb23333a9e 100644 --- a/internal/otelcollector/config/metricagent/testdata/multiple-inputs-mixed.yaml +++ b/internal/otelcollector/config/metricagent/testdata/multiple-inputs-mixed.yaml @@ -23,10 +23,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/input-prometheus: @@ -35,9 +35,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/input-runtime: @@ -48,10 +48,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test1: @@ -64,9 +64,9 @@ service: - filter/drop-envoy-metrics-if-disabled - filter/test1-filter-by-namespace-runtime-input - filter/test1-filter-by-namespace-prometheus-input - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test1 @@ -77,9 +77,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-istio - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test2 @@ -89,9 +89,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test3 @@ -391,43 +391,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -459,6 +447,21 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test1: endpoint: ${OTLP_ENDPOINT_TEST1} diff --git a/internal/otelcollector/config/metricagent/testdata/prometheus-diagnostic.yaml b/internal/otelcollector/config/metricagent/testdata/prometheus-diagnostic.yaml index ab57d713b7..4c6d613e1c 100644 --- a/internal/otelcollector/config/metricagent/testdata/prometheus-diagnostic.yaml +++ b/internal/otelcollector/config/metricagent/testdata/prometheus-diagnostic.yaml @@ -22,9 +22,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/output-test: @@ -33,9 +33,9 @@ service: - routing/prometheus-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -208,39 +208,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-prometheus: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/prometheus") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/prometheus-namespace-filters.yaml b/internal/otelcollector/config/metricagent/testdata/prometheus-namespace-filters.yaml index 036d66136c..84544a426b 100644 --- a/internal/otelcollector/config/metricagent/testdata/prometheus-namespace-filters.yaml +++ b/internal/otelcollector/config/metricagent/testdata/prometheus-namespace-filters.yaml @@ -22,9 +22,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/output-test: @@ -35,9 +35,9 @@ service: - filter/drop-diagnostic-metrics-if-input-source-prometheus - filter/drop-envoy-metrics-if-disabled - filter/test-filter-by-namespace-prometheus-input - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -221,39 +221,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-prometheus: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/prometheus") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/prometheus-only.yaml b/internal/otelcollector/config/metricagent/testdata/prometheus-only.yaml index 230565d48a..01fafe3892 100644 --- a/internal/otelcollector/config/metricagent/testdata/prometheus-only.yaml +++ b/internal/otelcollector/config/metricagent/testdata/prometheus-only.yaml @@ -22,9 +22,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/output-test: @@ -34,9 +34,9 @@ service: processors: - filter/drop-diagnostic-metrics-if-input-source-prometheus - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -214,39 +214,42 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/set-instrumentation-scope-prometheus: error_mode: ignore metric_statements: - statements: - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" - set(scope.name, "io.kyma-project.telemetry/prometheus") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/runtime-namespace-filters.yaml b/internal/otelcollector/config/metricagent/testdata/runtime-namespace-filters.yaml index 02e0df6ebd..d445fe91c6 100644 --- a/internal/otelcollector/config/metricagent/testdata/runtime-namespace-filters.yaml +++ b/internal/otelcollector/config/metricagent/testdata/runtime-namespace-filters.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -37,9 +37,9 @@ service: processors: - filter/drop-envoy-metrics-if-disabled - filter/test-filter-by-namespace-runtime-input - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -197,33 +197,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -243,6 +241,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/runtime-only.yaml b/internal/otelcollector/config/metricagent/testdata/runtime-only.yaml index 2711ccc8c5..f5b9c50442 100644 --- a/internal/otelcollector/config/metricagent/testdata/runtime-only.yaml +++ b/internal/otelcollector/config/metricagent/testdata/runtime-only.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -190,33 +190,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -236,6 +234,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-disabled.yaml b/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-disabled.yaml index ecf43cebf9..bee3886ead 100644 --- a/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-disabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-disabled.yaml @@ -23,10 +23,10 @@ service: processors: - memory_limiter - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -43,9 +43,9 @@ service: - filter/drop-runtime-statefulset-metrics - filter/drop-runtime-job-metrics - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -270,33 +270,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -316,6 +314,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-enabled.yaml b/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-enabled.yaml index 2711ccc8c5..f5b9c50442 100644 --- a/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-enabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/runtime-resources-all-enabled.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -190,33 +190,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -236,6 +234,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/runtime-resources-some-disabled.yaml b/internal/otelcollector/config/metricagent/testdata/runtime-resources-some-disabled.yaml index d696adaf04..75cdaae5d6 100644 --- a/internal/otelcollector/config/metricagent/testdata/runtime-resources-some-disabled.yaml +++ b/internal/otelcollector/config/metricagent/testdata/runtime-resources-some-disabled.yaml @@ -23,10 +23,10 @@ service: processors: - memory_limiter - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -39,9 +39,9 @@ service: - filter/drop-runtime-volume-metrics - filter/drop-runtime-daemonset-metrics - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -215,33 +215,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -261,6 +259,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricagent/testdata/setup-comprehensive.yaml b/internal/otelcollector/config/metricagent/testdata/setup-comprehensive.yaml index 7dbc79e897..184e704572 100644 --- a/internal/otelcollector/config/metricagent/testdata/setup-comprehensive.yaml +++ b/internal/otelcollector/config/metricagent/testdata/setup-comprehensive.yaml @@ -23,10 +23,10 @@ service: - prometheus/istio processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - istio_noise_filter - transform/set-instrumentation-scope-istio - - resource/set-kyma-input-name-istio + - transform/set-kyma-input-name-istio exporters: - routing/istio-input metrics/input-prometheus: @@ -35,9 +35,9 @@ service: - prometheus/app-services processors: - memory_limiter - - resource/drop-service-name + - transform/drop-service-name - transform/set-instrumentation-scope-prometheus - - resource/set-kyma-input-name-prometheus + - transform/set-kyma-input-name-prometheus exporters: - routing/prometheus-input metrics/input-runtime: @@ -48,10 +48,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test: @@ -64,9 +64,9 @@ service: - filter/drop-diagnostic-metrics-if-input-source-istio - filter/test-filter-by-namespace-runtime-input - filter/test-filter-by-namespace-prometheus-input - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - transform/user-defined-test - batch exporters: @@ -357,43 +357,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-istio: - attributes: - - action: insert - key: kyma.input.name - value: istio - resource/set-kyma-input-name-prometheus: - attributes: - - action: insert - key: kyma.input.name - value: prometheus - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -425,6 +413,21 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-istio: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "istio") + transform/set-kyma-input-name-prometheus: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "prometheus") + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") transform/user-defined-test: error_mode: ignore metric_statements: diff --git a/internal/otelcollector/config/metricagent/testdata/user-defined-filters.yaml b/internal/otelcollector/config/metricagent/testdata/user-defined-filters.yaml index 69b96d5dd1..b88bafe849 100644 --- a/internal/otelcollector/config/metricagent/testdata/user-defined-filters.yaml +++ b/internal/otelcollector/config/metricagent/testdata/user-defined-filters.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test1: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - filter/user-defined-test1 - batch exporters: @@ -49,9 +49,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - filter/user-defined-test2 - batch exporters: @@ -214,33 +214,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -260,6 +258,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") exporters: otlp/test1: endpoint: ${OTLP_ENDPOINT_TEST1} diff --git a/internal/otelcollector/config/metricagent/testdata/user-defined-transform-filter.yaml b/internal/otelcollector/config/metricagent/testdata/user-defined-transform-filter.yaml index 26bd72068b..02cfca5caf 100644 --- a/internal/otelcollector/config/metricagent/testdata/user-defined-transform-filter.yaml +++ b/internal/otelcollector/config/metricagent/testdata/user-defined-transform-filter.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test1: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - transform/user-defined-test1 - filter/user-defined-test1 - batch @@ -197,33 +197,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -243,6 +241,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") transform/user-defined-test1: error_mode: ignore metric_statements: diff --git a/internal/otelcollector/config/metricagent/testdata/user-defined-transforms.yaml b/internal/otelcollector/config/metricagent/testdata/user-defined-transforms.yaml index b4c928cf7c..8a8f4e04a8 100644 --- a/internal/otelcollector/config/metricagent/testdata/user-defined-transforms.yaml +++ b/internal/otelcollector/config/metricagent/testdata/user-defined-transforms.yaml @@ -24,10 +24,10 @@ service: - memory_limiter - filter/drop-non-pvc-volumes-metrics - filter/drop-virtual-network-interfaces - - resource/drop-service-name + - transform/drop-service-name - transform/insert-skip-enrichment-attribute - transform/set-instrumentation-scope-runtime - - resource/set-kyma-input-name-runtime + - transform/set-kyma-input-name-runtime exporters: - routing/runtime-input metrics/output-test1: @@ -36,9 +36,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - transform/user-defined-test1 - batch exporters: @@ -49,9 +49,9 @@ service: - routing/runtime-input processors: - filter/drop-envoy-metrics-if-disabled - - resource/insert-cluster-attributes - - resource/drop-skip-enrichment-attribute - - resource/drop-kyma-attributes + - transform/insert-cluster-attributes + - transform/drop-skip-enrichment-attribute + - transform/drop-kyma-attributes - transform/user-defined-test2 - batch exporters: @@ -204,33 +204,31 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/drop-service-name: - attributes: - - action: delete - key: service.name - resource/drop-skip-enrichment-attribute: - attributes: - - action: delete - key: io.kyma-project.telemetry.skip_enrichment - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - - action: insert - key: k8s.cluster.uid - resource/set-kyma-input-name-runtime: - attributes: - - action: insert - key: kyma.input.name - value: runtime service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/drop-service-name: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "service.name") + transform/drop-skip-enrichment-attribute: + error_mode: ignore + metric_statements: + - statements: + - delete_key(resource.attributes, "io.kyma-project.telemetry.skip_enrichment") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "") + - set(resource.attributes["k8s.cluster.uid"], "") transform/insert-skip-enrichment-attribute: error_mode: ignore metric_statements: @@ -250,6 +248,11 @@ processors: - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver" - set(scope.version, "main") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" - set(scope.name, "io.kyma-project.telemetry/runtime") where scope.name == "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver" + transform/set-kyma-input-name-runtime: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "runtime") transform/user-defined-test1: error_mode: ignore metric_statements: diff --git a/internal/otelcollector/config/metricgateway/config_builder.go b/internal/otelcollector/config/metricgateway/config_builder.go index 0f0f088595..156502eeb5 100644 --- a/internal/otelcollector/config/metricgateway/config_builder.go +++ b/internal/otelcollector/config/metricgateway/config_builder.go @@ -22,11 +22,9 @@ type Builder struct { } type BuildOptions struct { + Cluster common.ClusterOptions GatewayNamespace string InstrumentationScopeVersion string - ClusterName string - ClusterUID string - CloudProvider string Enrichments *operatorv1alpha1.EnrichmentSpec } @@ -142,7 +140,8 @@ func (b *Builder) addSetKymaInputNameProcessor(inputSource common.InputSourceTyp return b.AddProcessor( b.StaticComponentID(common.InputName[inputSource]), func(mp *telemetryv1alpha1.MetricPipeline) any { - return common.KymaInputNameProcessorConfig(inputSource) + transformStatements := common.KymaInputNameProcessorStatements(inputSource) + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -194,7 +193,8 @@ func (b *Builder) addInsertClusterAttributesProcessor(opts BuildOptions) buildCo return b.AddProcessor( b.StaticComponentID(common.ComponentIDInsertClusterAttributesProcessor), func(mp *telemetryv1alpha1.MetricPipeline) any { - return common.InsertClusterAttributesProcessorConfig(opts.ClusterName, opts.ClusterUID, opts.CloudProvider) + transformStatements := common.InsertClusterAttributesProcessorStatements(opts.Cluster) + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -279,7 +279,8 @@ func (b *Builder) addDropKymaAttributesProcessor() buildComponentFunc { return b.AddProcessor( b.StaticComponentID(common.ComponentIDDropKymaAttributesProcessor), func(mp *telemetryv1alpha1.MetricPipeline) any { - return common.DropKymaAttributesProcessorConfig() + transformStatements := common.DropKymaAttributesProcessorStatements() + return common.MetricTransformProcessorConfig(transformStatements) }, ) } @@ -293,9 +294,8 @@ func (b *Builder) addUserDefinedTransformProcessor() buildComponentFunc { } transformStatements := common.TransformSpecsToProcessorStatements(mp.Spec.Transforms) - transformProcessor := common.MetricTransformProcessorConfig(transformStatements) - return transformProcessor + return common.MetricTransformProcessorConfig(transformStatements) }, ) } diff --git a/internal/otelcollector/config/metricgateway/config_builder_test.go b/internal/otelcollector/config/metricgateway/config_builder_test.go index 9283e4ce78..0a48050fd2 100644 --- a/internal/otelcollector/config/metricgateway/config_builder_test.go +++ b/internal/otelcollector/config/metricgateway/config_builder_test.go @@ -10,6 +10,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" ) @@ -190,8 +191,10 @@ func TestMakeConfig(t *testing.T) { } buildOptions := BuildOptions{ - ClusterName: "${KUBERNETES_SERVICE_HOST}", - CloudProvider: "test-cloud-provider", + Cluster: common.ClusterOptions{ + ClusterName: "${KUBERNETES_SERVICE_HOST}", + CloudProvider: "test-cloud-provider", + }, } for _, tt := range tests { diff --git a/internal/otelcollector/config/metricgateway/testdata/http-protocol-with-custom-path.yaml b/internal/otelcollector/config/metricgateway/testdata/http-protocol-with-custom-path.yaml index a1650d4268..6735574fe4 100644 --- a/internal/otelcollector/config/metricgateway/testdata/http-protocol-with-custom-path.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/http-protocol-with-custom-path.yaml @@ -16,28 +16,28 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input metrics/test-output: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlphttp/test @@ -130,40 +130,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlphttp/test: metrics_endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricgateway/testdata/http-protocol-without-custom-path.yaml b/internal/otelcollector/config/metricgateway/testdata/http-protocol-without-custom-path.yaml index 5fdb4f2d5c..2fb22207f8 100644 --- a/internal/otelcollector/config/metricgateway/testdata/http-protocol-without-custom-path.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/http-protocol-without-custom-path.yaml @@ -16,28 +16,28 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input metrics/test-output: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlphttp/test @@ -130,40 +130,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlphttp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricgateway/testdata/otlp-disabled.yaml b/internal/otelcollector/config/metricgateway/testdata/otlp-disabled.yaml index 3108619477..4efef49eba 100644 --- a/internal/otelcollector/config/metricgateway/testdata/otlp-disabled.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/otlp-disabled.yaml @@ -16,21 +16,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input metrics/test-output: @@ -38,7 +38,7 @@ service: - forward/enrichment processors: - filter/drop-if-input-source-otlp - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -136,40 +136,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricgateway/testdata/otlp-namespace-filters.yaml b/internal/otelcollector/config/metricgateway/testdata/otlp-namespace-filters.yaml index 4e0a1c12ea..2f7f4d000d 100644 --- a/internal/otelcollector/config/metricgateway/testdata/otlp-namespace-filters.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/otlp-namespace-filters.yaml @@ -13,7 +13,7 @@ service: - forward/enrichment processors: - filter/cls-filter-by-namespace-otlp-input - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlp/cls @@ -25,21 +25,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input telemetry: @@ -137,40 +137,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlp/cls: endpoint: ${OTLP_ENDPOINT_CLS} diff --git a/internal/otelcollector/config/metricgateway/testdata/otlp-only.yaml b/internal/otelcollector/config/metricgateway/testdata/otlp-only.yaml index 7d536ffa4e..3d07e13c44 100644 --- a/internal/otelcollector/config/metricgateway/testdata/otlp-only.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/otlp-only.yaml @@ -12,7 +12,7 @@ service: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlp/cls @@ -24,21 +24,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input telemetry: @@ -130,40 +130,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlp/cls: endpoint: ${OTLP_ENDPOINT_CLS} diff --git a/internal/otelcollector/config/metricgateway/testdata/setup-comprehensive.yaml b/internal/otelcollector/config/metricgateway/testdata/setup-comprehensive.yaml index b00b74145c..9841d571e1 100644 --- a/internal/otelcollector/config/metricgateway/testdata/setup-comprehensive.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/setup-comprehensive.yaml @@ -13,7 +13,7 @@ service: - forward/enrichment processors: - filter/cls-filter-by-namespace-otlp-input - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-cls - filter/user-defined-cls - batch @@ -24,7 +24,7 @@ service: - forward/enrichment processors: - filter/dynatrace-filter-by-namespace-otlp-input - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-dynatrace - filter/user-defined-dynatrace - batch @@ -38,21 +38,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input telemetry: @@ -164,40 +164,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") transform/user-defined-cls: error_mode: ignore metric_statements: diff --git a/internal/otelcollector/config/metricgateway/testdata/setup-simple.yaml b/internal/otelcollector/config/metricgateway/testdata/setup-simple.yaml index f70de7f9a1..32cce2d5b0 100644 --- a/internal/otelcollector/config/metricgateway/testdata/setup-simple.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/setup-simple.yaml @@ -16,28 +16,28 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input metrics/test-output: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -130,40 +130,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/metricgateway/testdata/user-defined-filters.yaml b/internal/otelcollector/config/metricgateway/testdata/user-defined-filters.yaml index 4a2e4ee5dc..bab6462ebb 100644 --- a/internal/otelcollector/config/metricgateway/testdata/user-defined-filters.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/user-defined-filters.yaml @@ -12,7 +12,7 @@ service: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - filter/user-defined-cls - batch exporters: @@ -21,7 +21,7 @@ service: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - filter/user-defined-dynatrace - batch exporters: @@ -34,21 +34,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input telemetry: @@ -150,40 +150,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") exporters: otlp/cls: endpoint: ${OTLP_ENDPOINT_CLS} diff --git a/internal/otelcollector/config/metricgateway/testdata/user-defined-transform-filter.yaml b/internal/otelcollector/config/metricgateway/testdata/user-defined-transform-filter.yaml index 4ce2590db4..2543b8b7d6 100644 --- a/internal/otelcollector/config/metricgateway/testdata/user-defined-transform-filter.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/user-defined-transform-filter.yaml @@ -12,7 +12,7 @@ service: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-cls - filter/user-defined-cls - batch @@ -26,21 +26,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input telemetry: @@ -137,40 +137,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") transform/user-defined-cls: error_mode: ignore metric_statements: diff --git a/internal/otelcollector/config/metricgateway/testdata/user-defined-transforms.yaml b/internal/otelcollector/config/metricgateway/testdata/user-defined-transforms.yaml index be477a8f5a..b4c07e94d3 100644 --- a/internal/otelcollector/config/metricgateway/testdata/user-defined-transforms.yaml +++ b/internal/otelcollector/config/metricgateway/testdata/user-defined-transforms.yaml @@ -12,7 +12,7 @@ service: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-cls - batch exporters: @@ -21,7 +21,7 @@ service: receivers: - forward/enrichment processors: - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-dynatrace - batch exporters: @@ -34,21 +34,21 @@ service: - transform/set-instrumentation-scope-kyma - k8sattributes - service_enrichment - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes exporters: - forward/enrichment metrics/input-kyma-stats: receivers: - kymastats processors: - - resource/set-kyma-input-name-kyma + - transform/set-kyma-input-name-kyma exporters: - forward/input metrics/input-otlp: receivers: - otlp processors: - - resource/set-kyma-input-name-otlp + - transform/set-kyma-input-name-otlp exporters: - forward/input telemetry: @@ -140,40 +140,38 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider - resource/set-kyma-input-name-kyma: - attributes: - - action: insert - key: kyma.input.name - value: kyma - resource/set-kyma-input-name-otlp: - attributes: - - action: insert - key: kyma.input.name - value: otlp service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + metric_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/set-instrumentation-scope-kyma: error_mode: ignore metric_statements: - statements: - set(scope.version, "") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" - set(scope.name, "io.kyma-project.telemetry/kyma") where scope.name == "github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver" + transform/set-kyma-input-name-kyma: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "kyma") + transform/set-kyma-input-name-otlp: + error_mode: ignore + metric_statements: + - statements: + - set(resource.attributes["kyma.input.name"], "otlp") transform/user-defined-cls: error_mode: ignore metric_statements: diff --git a/internal/otelcollector/config/tracegateway/config_builder.go b/internal/otelcollector/config/tracegateway/config_builder.go index 031e88e71f..90d9ea93a4 100644 --- a/internal/otelcollector/config/tracegateway/config_builder.go +++ b/internal/otelcollector/config/tracegateway/config_builder.go @@ -21,10 +21,8 @@ type Builder struct { } type BuildOptions struct { - ClusterName string - ClusterUID string - CloudProvider string - Enrichments *operatorv1alpha1.EnrichmentSpec + Cluster common.ClusterOptions + Enrichments *operatorv1alpha1.EnrichmentSpec } func (b *Builder) Build(ctx context.Context, pipelines []telemetryv1alpha1.TracePipeline, opts BuildOptions) (*common.Config, common.EnvVars, error) { @@ -112,9 +110,8 @@ func (b *Builder) addInsertClusterAttributesProcessor(opts BuildOptions) buildCo return b.AddProcessor( b.StaticComponentID(common.ComponentIDInsertClusterAttributesProcessor), func(tp *telemetryv1alpha1.TracePipeline) any { - return common.InsertClusterAttributesProcessorConfig( - opts.ClusterName, opts.ClusterUID, opts.CloudProvider, - ) + transformStatements := common.InsertClusterAttributesProcessorStatements(opts.Cluster) + return common.TraceTransformProcessorConfig(transformStatements) }, ) } @@ -132,7 +129,8 @@ func (b *Builder) addDropKymaAttributesProcessor() buildComponentFunc { return b.AddProcessor( b.StaticComponentID(common.ComponentIDDropKymaAttributesProcessor), func(tp *telemetryv1alpha1.TracePipeline) any { - return common.DropKymaAttributesProcessorConfig() + transformStatements := common.DropKymaAttributesProcessorStatements() + return common.TraceTransformProcessorConfig(transformStatements) }, ) } @@ -147,9 +145,8 @@ func (b *Builder) addUserDefinedTransformProcessor() buildComponentFunc { } transformStatements := common.TransformSpecsToProcessorStatements(tp.Spec.Transforms) - transformProcessor := common.TraceTransformProcessorConfig(transformStatements) - return transformProcessor + return common.TraceTransformProcessorConfig(transformStatements) }, ) } diff --git a/internal/otelcollector/config/tracegateway/config_builder_test.go b/internal/otelcollector/config/tracegateway/config_builder_test.go index 498756a4ef..a6a7be57d4 100644 --- a/internal/otelcollector/config/tracegateway/config_builder_test.go +++ b/internal/otelcollector/config/tracegateway/config_builder_test.go @@ -10,6 +10,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" ) @@ -114,8 +115,10 @@ func TestBuildConfig(t *testing.T) { } buildOptions := BuildOptions{ - ClusterName: "${KUBERNETES_SERVICE_HOST}", - CloudProvider: "test-cloud-provider", + Cluster: common.ClusterOptions{ + ClusterName: "${KUBERNETES_SERVICE_HOST}", + CloudProvider: "test-cloud-provider", + }, } for _, tt := range tests { diff --git a/internal/otelcollector/config/tracegateway/testdata/http-protocol-with-custom-path.yaml b/internal/otelcollector/config/tracegateway/testdata/http-protocol-with-custom-path.yaml index eed3cdf6e8..84482d211a 100644 --- a/internal/otelcollector/config/tracegateway/testdata/http-protocol-with-custom-path.yaml +++ b/internal/otelcollector/config/tracegateway/testdata/http-protocol-with-custom-path.yaml @@ -12,9 +12,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlphttp/test @@ -90,24 +90,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + trace_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + trace_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") exporters: otlphttp/test: traces_endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/tracegateway/testdata/http-protocol-without-custom-path.yaml b/internal/otelcollector/config/tracegateway/testdata/http-protocol-without-custom-path.yaml index 3c26cd302e..d241b089b6 100644 --- a/internal/otelcollector/config/tracegateway/testdata/http-protocol-without-custom-path.yaml +++ b/internal/otelcollector/config/tracegateway/testdata/http-protocol-without-custom-path.yaml @@ -12,9 +12,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlphttp/test @@ -90,24 +90,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + trace_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + trace_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") exporters: otlphttp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/tracegateway/testdata/single-pipeline.yaml b/internal/otelcollector/config/tracegateway/testdata/single-pipeline.yaml index 822d996066..5264969849 100644 --- a/internal/otelcollector/config/tracegateway/testdata/single-pipeline.yaml +++ b/internal/otelcollector/config/tracegateway/testdata/single-pipeline.yaml @@ -12,9 +12,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - batch exporters: - otlp/test @@ -90,24 +90,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + trace_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + trace_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") exporters: otlp/test: endpoint: ${OTLP_ENDPOINT_TEST} diff --git a/internal/otelcollector/config/tracegateway/testdata/user-defined-filters.yaml b/internal/otelcollector/config/tracegateway/testdata/user-defined-filters.yaml index 4177931219..b53a1e442f 100644 --- a/internal/otelcollector/config/tracegateway/testdata/user-defined-filters.yaml +++ b/internal/otelcollector/config/tracegateway/testdata/user-defined-filters.yaml @@ -12,9 +12,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - filter/user-defined-test1 - batch exporters: @@ -26,9 +26,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - filter/user-defined-test2 - batch exporters: @@ -115,24 +115,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + trace_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + trace_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") exporters: otlp/test1: endpoint: ${OTLP_ENDPOINT_TEST1} diff --git a/internal/otelcollector/config/tracegateway/testdata/user-defined-transform-filter.yaml b/internal/otelcollector/config/tracegateway/testdata/user-defined-transform-filter.yaml index dc202721fe..2bfef044d3 100644 --- a/internal/otelcollector/config/tracegateway/testdata/user-defined-transform-filter.yaml +++ b/internal/otelcollector/config/tracegateway/testdata/user-defined-transform-filter.yaml @@ -12,9 +12,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-test1 - filter/user-defined-test1 - batch @@ -97,24 +97,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + trace_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + trace_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/user-defined-test1: error_mode: ignore trace_statements: diff --git a/internal/otelcollector/config/tracegateway/testdata/user-defined-transforms.yaml b/internal/otelcollector/config/tracegateway/testdata/user-defined-transforms.yaml index e136a37c5d..4ead87a39e 100644 --- a/internal/otelcollector/config/tracegateway/testdata/user-defined-transforms.yaml +++ b/internal/otelcollector/config/tracegateway/testdata/user-defined-transforms.yaml @@ -12,9 +12,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-test1 - batch exporters: @@ -26,9 +26,9 @@ service: - memory_limiter - k8sattributes - istio_noise_filter - - resource/insert-cluster-attributes + - transform/insert-cluster-attributes - service_enrichment - - resource/drop-kyma-attributes + - transform/drop-kyma-attributes - transform/user-defined-test2 - batch exporters: @@ -105,24 +105,22 @@ processors: check_interval: 1s limit_percentage: 75 spike_limit_percentage: 15 - resource/drop-kyma-attributes: - attributes: - - action: delete - pattern: kyma.* - resource/insert-cluster-attributes: - attributes: - - action: insert - key: k8s.cluster.name - value: ${KUBERNETES_SERVICE_HOST} - - action: insert - key: k8s.cluster.uid - - action: insert - key: cloud.provider - value: test-cloud-provider service_enrichment: resource_attributes: - kyma.kubernetes_io_app_name - kyma.app_name + transform/drop-kyma-attributes: + error_mode: ignore + trace_statements: + - statements: + - delete_matching_keys(resource.attributes, "kyma.*") + transform/insert-cluster-attributes: + error_mode: ignore + trace_statements: + - statements: + - set(resource.attributes["k8s.cluster.name"], "${KUBERNETES_SERVICE_HOST}") + - set(resource.attributes["k8s.cluster.uid"], "") + - set(resource.attributes["cloud.provider"], "test-cloud-provider") transform/user-defined-test1: error_mode: ignore trace_statements: diff --git a/internal/reconciler/logpipeline/otel/reconciler.go b/internal/reconciler/logpipeline/otel/reconciler.go index fd8273dfaa..6b29f76eb8 100644 --- a/internal/reconciler/logpipeline/otel/reconciler.go +++ b/internal/reconciler/logpipeline/otel/reconciler.go @@ -16,6 +16,7 @@ import ( "github.com/kyma-project/telemetry-manager/internal/config" "github.com/kyma-project/telemetry-manager/internal/errortypes" "github.com/kyma-project/telemetry-manager/internal/metrics" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/logagent" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/loggateway" "github.com/kyma-project/telemetry-manager/internal/resourcelock" @@ -293,9 +294,11 @@ func (r *Reconciler) reconcileLogGateway(ctx context.Context, pipeline *telemetr } collectorConfig, collectorEnvVars, err := r.gatewayConfigBuilder.Build(ctx, allPipelines, loggateway.BuildOptions{ - ClusterName: clusterName, - ClusterUID: clusterUID, - CloudProvider: shootInfo.CloudProvider, + Cluster: common.ClusterOptions{ + ClusterName: clusterName, + ClusterUID: clusterUID, + CloudProvider: shootInfo.CloudProvider, + }, Enrichments: enrichments, ModuleVersion: r.globals.Version(), }) @@ -348,10 +351,12 @@ func (r *Reconciler) reconcileLogAgent(ctx context.Context, pipeline *telemetryv agentConfig, envVars, err := r.agentConfigBuilder.Build(ctx, allPipelines, logagent.BuildOptions{ InstrumentationScopeVersion: r.globals.Version(), AgentNamespace: r.globals.TargetNamespace(), - ClusterName: clusterName, - ClusterUID: clusterUID, - CloudProvider: shootInfo.CloudProvider, - Enrichments: enrichments, + Cluster: common.ClusterOptions{ + ClusterName: clusterName, + ClusterUID: clusterUID, + CloudProvider: shootInfo.CloudProvider, + }, + Enrichments: enrichments, }) if err != nil { return fmt.Errorf("failed to build agent config: %w", err) diff --git a/internal/reconciler/metricpipeline/reconciler.go b/internal/reconciler/metricpipeline/reconciler.go index b92c4c61c6..fc4dd4be18 100644 --- a/internal/reconciler/metricpipeline/reconciler.go +++ b/internal/reconciler/metricpipeline/reconciler.go @@ -17,6 +17,7 @@ import ( "github.com/kyma-project/telemetry-manager/internal/config" "github.com/kyma-project/telemetry-manager/internal/errortypes" "github.com/kyma-project/telemetry-manager/internal/metrics" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metricagent" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metricgateway" "github.com/kyma-project/telemetry-manager/internal/reconciler/commonstatus" @@ -349,10 +350,12 @@ func (r *Reconciler) reconcileMetricGateway(ctx context.Context, pipeline *telem collectorConfig, collectorEnvVars, err := r.gatewayConfigBuilder.Build(ctx, allPipelines, metricgateway.BuildOptions{ GatewayNamespace: r.globals.TargetNamespace(), InstrumentationScopeVersion: r.globals.Version(), - ClusterName: clusterName, - ClusterUID: clusterUID, - CloudProvider: shootInfo.CloudProvider, - Enrichments: enrichments, + Cluster: common.ClusterOptions{ + ClusterName: clusterName, + ClusterUID: clusterUID, + CloudProvider: shootInfo.CloudProvider, + }, + Enrichments: enrichments, }) if err != nil { return fmt.Errorf("failed to create collector config: %w", err) @@ -406,10 +409,12 @@ func (r *Reconciler) reconcileMetricAgents(ctx context.Context, pipeline *teleme IstioCertPath: otelcollector.IstioCertPath, InstrumentationScopeVersion: r.globals.Version(), AgentNamespace: r.globals.TargetNamespace(), - ClusterName: clusterName, - ClusterUID: clusterUID, - CloudProvider: shootInfo.CloudProvider, - Enrichments: enrichments, + Cluster: common.ClusterOptions{ + ClusterName: clusterName, + ClusterUID: clusterUID, + CloudProvider: shootInfo.CloudProvider, + }, + Enrichments: enrichments, }) if err != nil { return fmt.Errorf("failed to create collector config: %w", err) diff --git a/internal/reconciler/tracepipeline/reconciler.go b/internal/reconciler/tracepipeline/reconciler.go index 4e29c1b9bd..afc1915ba5 100644 --- a/internal/reconciler/tracepipeline/reconciler.go +++ b/internal/reconciler/tracepipeline/reconciler.go @@ -33,6 +33,7 @@ import ( "github.com/kyma-project/telemetry-manager/internal/config" "github.com/kyma-project/telemetry-manager/internal/errortypes" "github.com/kyma-project/telemetry-manager/internal/metrics" + "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/common" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/tracegateway" "github.com/kyma-project/telemetry-manager/internal/reconciler/commonstatus" "github.com/kyma-project/telemetry-manager/internal/resourcelock" @@ -305,10 +306,12 @@ func (r *Reconciler) reconcileTraceGateway(ctx context.Context, pipeline *teleme } collectorConfig, collectorEnvVars, err := r.gatewayConfigBuilder.Build(ctx, allPipelines, tracegateway.BuildOptions{ - ClusterName: clusterName, - ClusterUID: clusterUID, - CloudProvider: shootInfo.CloudProvider, - Enrichments: enrichments, + Cluster: common.ClusterOptions{ + ClusterName: clusterName, + ClusterUID: clusterUID, + CloudProvider: shootInfo.CloudProvider, + }, + Enrichments: enrichments, }) if err != nil { return fmt.Errorf("failed to create collector config: %w", err) diff --git a/test/e2e/logs/gateway/empty_enrichment_values_test.go b/test/e2e/logs/gateway/empty_enrichment_values_test.go new file mode 100644 index 0000000000..a4ade9042f --- /dev/null +++ b/test/e2e/logs/gateway/empty_enrichment_values_test.go @@ -0,0 +1,114 @@ +package gateway + +import ( + "testing" + + . "github.com/onsi/gomega" + "sigs.k8s.io/controller-runtime/pkg/client" + + testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" + "github.com/kyma-project/telemetry-manager/test/testkit/assert" + kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" + kitk8sobjects "github.com/kyma-project/telemetry-manager/test/testkit/k8s/objects" + kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" + . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" + kitbackend "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" + "github.com/kyma-project/telemetry-manager/test/testkit/suite" + "github.com/kyma-project/telemetry-manager/test/testkit/unique" +) + +func TestEmptyEnrichmentValues(t *testing.T) { + suite.RegisterTestCase(t, suite.LabelLogGateway) + + var ( + uniquePrefix = unique.Prefix() + pipelineName = uniquePrefix() + backendNs = uniquePrefix("backend") + genNs = uniquePrefix("gen") + ) + + backend := kitbackend.New(backendNs, kitbackend.SignalTypeLogsOTel) + pipeline := testutils.NewLogPipelineBuilder(). + WithName(pipelineName). + WithIncludeNamespaces(genNs). + WithOTLPOutput(testutils.OTLPEndpoint(backend.Endpoint())). + Build() + + // All attributes in the enrichment flow are set to empty values + generator := telemetrygen.NewPod( + genNs, + telemetrygen.SignalTypeLogs, + telemetrygen.WithResourceAttribute("cloud.availability_zone", ""), + telemetrygen.WithResourceAttribute("cloud.provider", ""), + telemetrygen.WithResourceAttribute("cloud.region", ""), + telemetrygen.WithResourceAttribute("host.arch", ""), + telemetrygen.WithResourceAttribute("host.type", ""), + telemetrygen.WithResourceAttribute("k8s.cluster.name", ""), + telemetrygen.WithResourceAttribute("k8s.cluster.uid", ""), + telemetrygen.WithResourceAttribute("k8s.cronjob.name", ""), + telemetrygen.WithResourceAttribute("k8s.daemonset.name", ""), + telemetrygen.WithResourceAttribute("k8s.deployment.name", ""), + telemetrygen.WithResourceAttribute("k8s.job.name", ""), + telemetrygen.WithResourceAttribute("k8s.namespace.name", ""), + telemetrygen.WithResourceAttribute("k8s.node.name", ""), + telemetrygen.WithResourceAttribute("k8s.pod.name", ""), + telemetrygen.WithResourceAttribute("k8s.statefulset.name", ""), + telemetrygen.WithResourceAttribute("kyma.app_name", ""), + telemetrygen.WithResourceAttribute("kyma.input.name", ""), + telemetrygen.WithResourceAttribute("kyma.kubernetes_io_app_name", ""), + telemetrygen.WithResourceAttribute("service.name", ""), + ) + + resources := []client.Object{ + kitk8sobjects.NewNamespace(backendNs).K8sObject(), + kitk8sobjects.NewNamespace(genNs).K8sObject(), + &pipeline, + generator.K8sObject(), + } + resources = append(resources, backend.K8sObjects()...) + + Expect(kitk8s.CreateObjects(t, resources...)).To(Succeed()) + + assert.BackendReachable(t, backend) + assert.DeploymentReady(t, kitkyma.LogGatewayName) + assert.OTelLogPipelineHealthy(t, pipelineName) + assert.OTelLogsFromNamespaceDelivered(t, backend, genNs) + + // These attributes should be enriched by the processors + assert.BackendDataEventuallyMatches(t, backend, + HaveFlatLogs(ContainElement(SatisfyAll( + HaveResourceAttributes(HaveKeyWithValue("k8s.cluster.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.cluster.uid", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.provider", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.pod.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.node.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.namespace.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.region", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.availability_zone", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("host.type", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("host.arch", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("service.name", Not(BeEmpty()))), + ))), + ) + + // These attributes can't be so they shouldn't be enriched by the processors (if set to empty value) + assert.BackendDataEventuallyMatches(t, backend, + HaveFlatLogs(ContainElement(SatisfyAll( + HaveResourceAttributes(HaveKeyWithValue("k8s.deployment.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.statefulset.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.daemonset.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.cronjob.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.job.name", BeEmpty())), + ))), + ) + + // These attributes should be dropped by the processors + assert.BackendDataConsistentlyMatches(t, backend, + Not(HaveFlatLogs(ContainElement(SatisfyAny( + HaveResourceAttributes(HaveKey("kyma.kubernetes_io_app_name")), + HaveResourceAttributes(HaveKey("kyma.app_name")), + HaveResourceAttributes(HaveKey("kyma.input.name")), + )))), + ) +} diff --git a/test/e2e/logs/gateway/main_test.go b/test/e2e/logs/gateway/main_test.go new file mode 100644 index 0000000000..f38adf280c --- /dev/null +++ b/test/e2e/logs/gateway/main_test.go @@ -0,0 +1,20 @@ +package gateway + +import ( + "log" + "os" + "testing" + + "github.com/kyma-project/telemetry-manager/test/testkit/suite" +) + +func TestMain(m *testing.M) { + const errorCode = 1 + + if err := suite.BeforeSuiteFunc(); err != nil { + log.Printf("Setup failed: %v", err) + os.Exit(errorCode) + } + + m.Run() +} diff --git a/test/e2e/metrics/gateway/empty_enrichment_values_test.go b/test/e2e/metrics/gateway/empty_enrichment_values_test.go new file mode 100644 index 0000000000..b4d83a6a36 --- /dev/null +++ b/test/e2e/metrics/gateway/empty_enrichment_values_test.go @@ -0,0 +1,113 @@ +package gateway + +import ( + "testing" + + . "github.com/onsi/gomega" + "sigs.k8s.io/controller-runtime/pkg/client" + + testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" + "github.com/kyma-project/telemetry-manager/test/testkit/assert" + kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" + kitk8sobjects "github.com/kyma-project/telemetry-manager/test/testkit/k8s/objects" + kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" + . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" + kitbackend "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" + "github.com/kyma-project/telemetry-manager/test/testkit/suite" + "github.com/kyma-project/telemetry-manager/test/testkit/unique" +) + +func TestEmptyEnrichmentValues(t *testing.T) { + suite.RegisterTestCase(t, suite.LabelMetricGatewaySetC) + + var ( + uniquePrefix = unique.Prefix() + pipelineName = uniquePrefix() + backendNs = uniquePrefix("backend") + genNs = uniquePrefix("gen") + ) + + backend := kitbackend.New(backendNs, kitbackend.SignalTypeMetrics) + pipeline := testutils.NewMetricPipelineBuilder(). + WithName(pipelineName). + WithOTLPOutput(testutils.OTLPEndpoint(backend.Endpoint())). + Build() + + // All attributes in the enrichment flow are set to empty values + generator := telemetrygen.NewPod( + genNs, + telemetrygen.SignalTypeMetrics, + telemetrygen.WithResourceAttribute("cloud.availability_zone", ""), + telemetrygen.WithResourceAttribute("cloud.provider", ""), + telemetrygen.WithResourceAttribute("cloud.region", ""), + telemetrygen.WithResourceAttribute("host.arch", ""), + telemetrygen.WithResourceAttribute("host.type", ""), + telemetrygen.WithResourceAttribute("k8s.cluster.name", ""), + telemetrygen.WithResourceAttribute("k8s.cluster.uid", ""), + telemetrygen.WithResourceAttribute("k8s.cronjob.name", ""), + telemetrygen.WithResourceAttribute("k8s.daemonset.name", ""), + telemetrygen.WithResourceAttribute("k8s.deployment.name", ""), + telemetrygen.WithResourceAttribute("k8s.job.name", ""), + telemetrygen.WithResourceAttribute("k8s.namespace.name", ""), + telemetrygen.WithResourceAttribute("k8s.node.name", ""), + telemetrygen.WithResourceAttribute("k8s.pod.name", ""), + telemetrygen.WithResourceAttribute("k8s.statefulset.name", ""), + telemetrygen.WithResourceAttribute("kyma.app_name", ""), + telemetrygen.WithResourceAttribute("kyma.input.name", ""), + telemetrygen.WithResourceAttribute("kyma.kubernetes_io_app_name", ""), + telemetrygen.WithResourceAttribute("service.name", ""), + ) + + resources := []client.Object{ + kitk8sobjects.NewNamespace(backendNs).K8sObject(), + kitk8sobjects.NewNamespace(genNs).K8sObject(), + &pipeline, + generator.K8sObject(), + } + resources = append(resources, backend.K8sObjects()...) + + Expect(kitk8s.CreateObjects(t, resources...)).To(Succeed()) + + assert.BackendReachable(t, backend) + assert.DeploymentReady(t, kitkyma.MetricGatewayName) + assert.MetricPipelineHealthy(t, pipelineName) + assert.MetricsFromNamespaceDelivered(t, backend, genNs, telemetrygen.MetricNames) + + // These attributes should be enriched by the processors + assert.BackendDataEventuallyMatches(t, backend, + HaveFlatMetrics(ContainElement(SatisfyAll( + HaveResourceAttributes(HaveKeyWithValue("k8s.cluster.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.cluster.uid", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.provider", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.pod.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.node.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.namespace.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.region", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.availability_zone", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("host.type", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("host.arch", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("service.name", Not(BeEmpty()))), + ))), + ) + + // These attributes can't be so they shouldn't be enriched by the processors (if set to empty value) + assert.BackendDataEventuallyMatches(t, backend, + HaveFlatMetrics(ContainElement(SatisfyAll( + HaveResourceAttributes(HaveKeyWithValue("k8s.deployment.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.statefulset.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.daemonset.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.cronjob.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.job.name", BeEmpty())), + ))), + ) + + // These attributes should be dropped by the processors + assert.BackendDataConsistentlyMatches(t, backend, + Not(HaveFlatMetrics(ContainElement(SatisfyAny( + HaveResourceAttributes(HaveKey("kyma.kubernetes_io_app_name")), + HaveResourceAttributes(HaveKey("kyma.app_name")), + HaveResourceAttributes(HaveKey("kyma.input.name")), + )))), + ) +} diff --git a/test/e2e/traces/empty_enrichment_values_test.go b/test/e2e/traces/empty_enrichment_values_test.go new file mode 100644 index 0000000000..11ddf2f67a --- /dev/null +++ b/test/e2e/traces/empty_enrichment_values_test.go @@ -0,0 +1,113 @@ +package traces + +import ( + "testing" + + . "github.com/onsi/gomega" + "sigs.k8s.io/controller-runtime/pkg/client" + + testutils "github.com/kyma-project/telemetry-manager/internal/utils/test" + "github.com/kyma-project/telemetry-manager/test/testkit/assert" + kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" + kitk8sobjects "github.com/kyma-project/telemetry-manager/test/testkit/k8s/objects" + kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" + . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/trace" + kitbackend "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" + "github.com/kyma-project/telemetry-manager/test/testkit/suite" + "github.com/kyma-project/telemetry-manager/test/testkit/unique" +) + +func TestEmptyEnrichmentValues(t *testing.T) { + suite.RegisterTestCase(t, suite.LabelTraces) + + var ( + uniquePrefix = unique.Prefix() + pipelineName = uniquePrefix() + backendNs = uniquePrefix("backend") + genNs = uniquePrefix("gen") + ) + + backend := kitbackend.New(backendNs, kitbackend.SignalTypeTraces) + pipeline := testutils.NewTracePipelineBuilder(). + WithName(pipelineName). + WithOTLPOutput(testutils.OTLPEndpoint(backend.Endpoint())). + Build() + + // All attributes in the enrichment flow are set to empty values + generator := telemetrygen.NewPod( + genNs, + telemetrygen.SignalTypeTraces, + telemetrygen.WithResourceAttribute("cloud.availability_zone", ""), + telemetrygen.WithResourceAttribute("cloud.provider", ""), + telemetrygen.WithResourceAttribute("cloud.region", ""), + telemetrygen.WithResourceAttribute("host.arch", ""), + telemetrygen.WithResourceAttribute("host.type", ""), + telemetrygen.WithResourceAttribute("k8s.cluster.name", ""), + telemetrygen.WithResourceAttribute("k8s.cluster.uid", ""), + telemetrygen.WithResourceAttribute("k8s.cronjob.name", ""), + telemetrygen.WithResourceAttribute("k8s.daemonset.name", ""), + telemetrygen.WithResourceAttribute("k8s.deployment.name", ""), + telemetrygen.WithResourceAttribute("k8s.job.name", ""), + telemetrygen.WithResourceAttribute("k8s.namespace.name", ""), + telemetrygen.WithResourceAttribute("k8s.node.name", ""), + telemetrygen.WithResourceAttribute("k8s.pod.name", ""), + telemetrygen.WithResourceAttribute("k8s.statefulset.name", ""), + telemetrygen.WithResourceAttribute("kyma.app_name", ""), + telemetrygen.WithResourceAttribute("kyma.input.name", ""), + telemetrygen.WithResourceAttribute("kyma.kubernetes_io_app_name", ""), + telemetrygen.WithResourceAttribute("service.name", ""), + ) + + resources := []client.Object{ + kitk8sobjects.NewNamespace(backendNs).K8sObject(), + kitk8sobjects.NewNamespace(genNs).K8sObject(), + &pipeline, + generator.K8sObject(), + } + resources = append(resources, backend.K8sObjects()...) + + Expect(kitk8s.CreateObjects(t, resources...)).To(Succeed()) + + assert.BackendReachable(t, backend) + assert.DeploymentReady(t, kitkyma.TraceGatewayName) + assert.TracePipelineHealthy(t, pipelineName) + assert.TracesFromNamespaceDelivered(t, backend, genNs) + + // These attributes should be enriched by the processors + assert.BackendDataEventuallyMatches(t, backend, + HaveFlatTraces(ContainElement(SatisfyAll( + HaveResourceAttributes(HaveKeyWithValue("k8s.cluster.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.cluster.uid", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.provider", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.pod.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.node.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("k8s.namespace.name", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.region", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("cloud.availability_zone", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("host.type", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("host.arch", Not(BeEmpty()))), + HaveResourceAttributes(HaveKeyWithValue("service.name", Not(BeEmpty()))), + ))), + ) + + // These attributes can't be so they shouldn't be enriched by the processors (if set to empty value) + assert.BackendDataEventuallyMatches(t, backend, + HaveFlatTraces(ContainElement(SatisfyAll( + HaveResourceAttributes(HaveKeyWithValue("k8s.deployment.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.statefulset.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.daemonset.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.cronjob.name", BeEmpty())), + HaveResourceAttributes(HaveKeyWithValue("k8s.job.name", BeEmpty())), + ))), + ) + + // These attributes should be dropped by the processors + assert.BackendDataConsistentlyMatches(t, backend, + Not(HaveFlatTraces(ContainElement(SatisfyAny( + HaveResourceAttributes(HaveKey("kyma.kubernetes_io_app_name")), + HaveResourceAttributes(HaveKey("kyma.app_name")), + HaveResourceAttributes(HaveKey("kyma.input.name")), + )))), + ) +}