From d10b8e159b80a42dcd14f38e6a9aa75d277c6658 Mon Sep 17 00:00:00 2001 From: odubajDT <93584209+odubajDT@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:57:16 +0200 Subject: [PATCH] feat: add redaction processor (#275) Signed-off-by: odubajDT Co-authored-by: Florian Bacher Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com> --- .chloggen/add-redaction-processor.yaml | 18 +++ .github/workflows/e2e.yaml | 1 + README.md | 1 + config_examples/README.md | 1 + config_examples/redaction.yaml | 42 ++++++ .../testbed/integration/redaction/e2e_test.go | 134 ++++++++++++++++++ .../testdata/collector/clusterrole.yaml | 18 +++ .../collector/clusterrolebinding.yaml | 14 ++ .../testdata/collector/configmap.yaml | 77 ++++++++++ .../testdata/collector/deployment.yaml | 58 ++++++++ .../redaction/testdata/collector/service.yaml | 16 +++ .../testdata/collector/serviceaccount.yaml | 7 + .../redaction/testdata/namespace.yaml | 4 + .../testdata/telemetrygen/daemonset.yaml | 28 ++++ .../testdata/telemetrygen/deployment.yaml | 30 ++++ .../redaction/testdata/telemetrygen/job.yaml | 25 ++++ .../testdata/telemetrygen/statefulset.yaml | 30 ++++ .../testdata/config-allcomponents.yaml | 3 + manifest.yaml | 1 + 19 files changed, 508 insertions(+) create mode 100644 .chloggen/add-redaction-processor.yaml create mode 100644 config_examples/redaction.yaml create mode 100644 internal/testbed/integration/redaction/e2e_test.go create mode 100644 internal/testbed/integration/redaction/testdata/collector/clusterrole.yaml create mode 100644 internal/testbed/integration/redaction/testdata/collector/clusterrolebinding.yaml create mode 100644 internal/testbed/integration/redaction/testdata/collector/configmap.yaml create mode 100644 internal/testbed/integration/redaction/testdata/collector/deployment.yaml create mode 100644 internal/testbed/integration/redaction/testdata/collector/service.yaml create mode 100644 internal/testbed/integration/redaction/testdata/collector/serviceaccount.yaml create mode 100644 internal/testbed/integration/redaction/testdata/namespace.yaml create mode 100644 internal/testbed/integration/redaction/testdata/telemetrygen/daemonset.yaml create mode 100644 internal/testbed/integration/redaction/testdata/telemetrygen/deployment.yaml create mode 100644 internal/testbed/integration/redaction/testdata/telemetrygen/job.yaml create mode 100644 internal/testbed/integration/redaction/testdata/telemetrygen/statefulset.yaml diff --git a/.chloggen/add-redaction-processor.yaml b/.chloggen/add-redaction-processor.yaml new file mode 100644 index 00000000..a08a6fde --- /dev/null +++ b/.chloggen/add-redaction-processor.yaml @@ -0,0 +1,18 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: new_component + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: redactionprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Added the redaction processor to the Dynatrace collector distro. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [275] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 45465225..baf68a86 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -82,6 +82,7 @@ jobs: - prometheus - zipkin - statsd + - redaction runs-on: ubuntu-latest needs: docker-build steps: diff --git a/README.md b/README.md index 88689731..a0ddf0d6 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ and the Collector's [troubleshooting guide]. * [k8sattributesprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/k8sattributesprocessor) * [memorylimiterprocessor](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/memorylimiterprocessor) * [probabilisticsamplerprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/probabilisticsamplerprocessor) +* [redactionprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/redactionprocessor) * [resourcedetectionprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourcedetectionprocessor) * [resourceprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourceprocessor) * [tailsamplingprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/tailsamplingprocessor) diff --git a/config_examples/README.md b/config_examples/README.md index 1ca9bab3..4965a02b 100644 --- a/config_examples/README.md +++ b/config_examples/README.md @@ -22,6 +22,7 @@ Dynatrace distribution of the OpenTelemetry Collector. - [StatsD Receiver](statsd.yaml) - [Syslog Receiver](syslog.yaml) - [Zipkin Receiver](zipkin.yaml) +- [Redaction Processor](redaction.yaml) ## Sending data to Dynatrace diff --git a/config_examples/redaction.yaml b/config_examples/redaction.yaml new file mode 100644 index 00000000..84cb2e6f --- /dev/null +++ b/config_examples/redaction.yaml @@ -0,0 +1,42 @@ +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 + +processors: + redaction: + allow_all_keys: false + allowed_keys: + - description + - group + - name + ignored_keys: + - safe_attribute + blocked_values: + - "4[0-9]{12}(?:[0-9]{3})?" ## Visa credit card number + - "(5[1-5][0-9]{14})" ## MasterCard number + - "^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\b){4}$" ## IPv4 addresses + - "^[\\w\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$" ## email addresses (simplified example) + summary: info + +exporters: + otlphttp: + endpoint: ${env:DT_ENDPOINT} + headers: + Authorization: "Api-Token ${env:API_TOKEN}" + +extensions: + health_check: + endpoint: 0.0.0.0:13133 + +service: + extensions: + - health_check + pipelines: + traces: + receivers: [otlp] + processors: [redaction] + exporters: [otlphttp] diff --git a/internal/testbed/integration/redaction/e2e_test.go b/internal/testbed/integration/redaction/e2e_test.go new file mode 100644 index 00000000..723c2e47 --- /dev/null +++ b/internal/testbed/integration/redaction/e2e_test.go @@ -0,0 +1,134 @@ +//go:build e2e + +package redaction + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/Dynatrace/dynatrace-otel-collector/internal/testcommon/k8stest" + oteltest "github.com/Dynatrace/dynatrace-otel-collector/internal/testcommon/oteltest" + "github.com/google/uuid" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/consumer/consumertest" +) + +func TestE2E_RedactionProcessor(t *testing.T) { + testDir := filepath.Join("testdata") + + k8sClient, err := k8stest.NewK8sClient() + require.NoError(t, err) + + // Create the namespace specific for the test + nsFile := filepath.Join(testDir, "namespace.yaml") + buf, err := os.ReadFile(nsFile) + require.NoErrorf(t, err, "failed to read namespace object file %s", nsFile) + nsObj, err := k8stest.CreateObject(k8sClient, buf) + require.NoErrorf(t, err, "failed to create k8s namespace from file %s", nsFile) + + testNs := nsObj.GetName() + defer func() { + require.NoErrorf(t, k8stest.DeleteObject(k8sClient, nsObj), "failed to delete namespace %s", testNs) + }() + + tracesConsumer := new(consumertest.TracesSink) + shutdownSinks := oteltest.StartUpSinks(t, oteltest.ReceiverSinks{Traces: tracesConsumer}) + defer shutdownSinks() + + testID := uuid.NewString()[:8] + collectorObjs := k8stest.CreateCollectorObjects(t, k8sClient, testID, filepath.Join(testDir, "collector")) + + createTeleOpts := &k8stest.TelemetrygenCreateOpts{ + ManifestsDir: filepath.Join(testDir, "telemetrygen"), + TestID: testID, + OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, testNs), + DataTypes: []string{"traces"}, + } + telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts) + defer func() { + for _, obj := range append(collectorObjs, telemetryGenObjs...) { + require.NoErrorf(t, k8stest.DeleteObject(k8sClient, obj), "failed to delete object %s", obj.GetName()) + } + }() + + for _, info := range telemetryGenObjInfos { + k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType) + } + + wantEntries := 30 // Minimal number of traces to wait for. + oteltest.WaitForTraces(t, wantEntries, tracesConsumer) + + tcs := []struct { + name string + service string + attrs map[string]oteltest.ExpectedValue + }{ + { + name: "traces-job", + service: "test-traces-job", + attrs: map[string]oteltest.ExpectedValue{ + "service.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "test-traces-job"), + "k8s.pod.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeRegex, "telemetrygen-"+testID+"-traces-job-[a-z0-9]*"), + "k8s.pod.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "k8s.job.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "telemetrygen-"+testID+"-traces-job"), + "k8s.namespace.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, testNs), + "k8s.cluster.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "redaction.redacted.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.masked.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.ignored.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + }, + }, + { + name: "traces-statefulset", + service: "test-traces-statefulset", + attrs: map[string]oteltest.ExpectedValue{ + "service.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "test-traces-statefulset"), + "k8s.pod.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "telemetrygen-"+testID+"-traces-statefulset-0"), + "k8s.pod.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "k8s.statefulset.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "telemetrygen-"+testID+"-traces-statefulset"), + "k8s.namespace.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, testNs), + "k8s.cluster.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "redaction.redacted.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.masked.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.ignored.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + }, + }, + { + name: "traces-deployment", + service: "test-traces-deployment", + attrs: map[string]oteltest.ExpectedValue{ + "service.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "test-traces-deployment"), + "k8s.pod.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeRegex, "telemetrygen-"+testID+"-traces-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "k8s.deployment.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "telemetrygen-"+testID+"-traces-deployment"), + "k8s.namespace.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, testNs), + "k8s.cluster.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "redaction.redacted.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.masked.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.ignored.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + }, + }, + { + name: "traces-daemonset", + service: "test-traces-daemonset", + attrs: map[string]oteltest.ExpectedValue{ + "service.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "test-traces-daemonset"), + "k8s.pod.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeRegex, "telemetrygen-"+testID+"-traces-daemonset-[a-z0-9]*"), + "k8s.pod.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "k8s.daemonset.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "telemetrygen-"+testID+"-traces-daemonset"), + "k8s.namespace.name": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, testNs), + "k8s.cluster.uid": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "****"), + "redaction.redacted.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.masked.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + "redaction.ignored.count": oteltest.NewExpectedValue(oteltest.AttributeMatchTypeEqual, "2"), + }, + }, + } + + for _, tc := range tcs { + oteltest.ScanTracesForAttributes(t, tracesConsumer, tc.service, tc.attrs, nil) + } + +} diff --git a/internal/testbed/integration/redaction/testdata/collector/clusterrole.yaml b/internal/testbed/integration/redaction/testdata/collector/clusterrole.yaml new file mode 100644 index 00000000..69be9212 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/collector/clusterrole.yaml @@ -0,0 +1,18 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ .Name }} + labels: + app: {{ .Name }} +rules: + - apiGroups: [""] + resources: ["pods", "namespaces"] + verbs: ["get", "watch", "list"] + + - apiGroups: ["apps"] + resources: ["replicasets"] + verbs: ["get", "watch", "list"] + + - apiGroups: ["extensions"] + resources: ["replicasets"] + verbs: ["get", "watch", "list"] diff --git a/internal/testbed/integration/redaction/testdata/collector/clusterrolebinding.yaml b/internal/testbed/integration/redaction/testdata/collector/clusterrolebinding.yaml new file mode 100644 index 00000000..15f3e407 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/collector/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ .Name }} + labels: + app: {{ .Name }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ .Name }} +subjects: + - kind: ServiceAccount + name: {{ .Name }} + namespace: e2eredaction diff --git a/internal/testbed/integration/redaction/testdata/collector/configmap.yaml b/internal/testbed/integration/redaction/testdata/collector/configmap.yaml new file mode 100644 index 00000000..7e95457b --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/collector/configmap.yaml @@ -0,0 +1,77 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Name }}-config + namespace: e2eredaction +data: + relay: | + extensions: + health_check: + endpoint: 0.0.0.0:13133 + receivers: + otlp: + protocols: + grpc: + endpoint: ${env:MY_POD_IP}:4317 + processors: + k8sattributes: + extract: + metadata: + - k8s.pod.name + - k8s.pod.uid + - k8s.deployment.name + - k8s.statefulset.name + - k8s.daemonset.name + - k8s.job.name + - k8s.cronjob.name + - k8s.namespace.name + - k8s.node.name + - k8s.cluster.uid + pod_association: + - sources: + - from: resource_attribute + name: k8s.pod.name + - from: resource_attribute + name: k8s.namespace.name + - sources: + - from: resource_attribute + name: k8s.pod.ip + - sources: + - from: resource_attribute + name: k8s.pod.uid + - sources: + - from: connection + redaction: + allow_all_keys: false + allowed_keys: + - "k8s.pod.uid" + - "k8s.namespace.name" + - "k8s.cluster.uid" + - "k8s.job.name" + - "k8s.statefulset.name" + - "k8s.deployment.name" + - "k8s.daemonset.name" + ignored_keys: + - "k8s.pod.name" + - "service.name" + blocked_values: + - "^[a-f0-9]{32}$" + - "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" + summary: info + exporters: + otlp: + endpoint: {{ .HostEndpoint }}:4317 + tls: + insecure: true + service: + extensions: + - health_check + pipelines: + traces: + receivers: + - otlp + processors: + - k8sattributes + - redaction + exporters: + - otlp diff --git a/internal/testbed/integration/redaction/testdata/collector/deployment.yaml b/internal/testbed/integration/redaction/testdata/collector/deployment.yaml new file mode 100644 index 00000000..07095b47 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/collector/deployment.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Name }} + namespace: e2eredaction +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: opentelemetry-collector + app.kubernetes.io/instance: {{ .Name }} + template: + metadata: + labels: + app.kubernetes.io/name: opentelemetry-collector + app.kubernetes.io/instance: {{ .Name }} + spec: + serviceAccountName: {{ .Name }} + containers: + - name: opentelemetry-collector + command: + - /dynatrace-otel-collector + - --config=/conf/relay.yaml + image: "{{ .ContainerRegistry }}dynatrace-otel-collector:e2e-test" + ports: + - name: otlp + containerPort: 4317 + protocol: TCP + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + livenessProbe: + httpGet: + path: / + port: 13133 + initialDelaySeconds: 3 + readinessProbe: + httpGet: + path: / + port: 13133 + initialDelaySeconds: 3 + resources: + limits: + cpu: 128m + memory: 256Mi + volumeMounts: + - mountPath: /conf + name: opentelemetry-collector-configmap + volumes: + - name: opentelemetry-collector-configmap + configMap: + name: {{ .Name }}-config + items: + - key: relay + path: relay.yaml diff --git a/internal/testbed/integration/redaction/testdata/collector/service.yaml b/internal/testbed/integration/redaction/testdata/collector/service.yaml new file mode 100644 index 00000000..e1db99fc --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/collector/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Name }} + namespace: e2eredaction +spec: + type: ClusterIP + ports: + - name: otlp + port: 4317 + targetPort: 4317 + protocol: TCP + appProtocol: grpc + selector: + app.kubernetes.io/name: opentelemetry-collector + app.kubernetes.io/instance: {{ .Name }} diff --git a/internal/testbed/integration/redaction/testdata/collector/serviceaccount.yaml b/internal/testbed/integration/redaction/testdata/collector/serviceaccount.yaml new file mode 100644 index 00000000..6a8f7bf1 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/collector/serviceaccount.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ .Name }} + name: {{ .Name }} + namespace: e2eredaction diff --git a/internal/testbed/integration/redaction/testdata/namespace.yaml b/internal/testbed/integration/redaction/testdata/namespace.yaml new file mode 100644 index 00000000..007dd3b3 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: e2eredaction diff --git a/internal/testbed/integration/redaction/testdata/telemetrygen/daemonset.yaml b/internal/testbed/integration/redaction/testdata/telemetrygen/daemonset.yaml new file mode 100644 index 00000000..8cf961c4 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/telemetrygen/daemonset.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ .Name }}-{{ .DataType }}-daemonset + namespace: e2eredaction +spec: + selector: + matchLabels: + app: {{ .Name }}-{{ .DataType }}-daemonset + template: + metadata: + annotations: + workload: daemonset + labels: + app: {{ .Name }}-{{ .DataType }}-daemonset + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --duration=36000s + - --rate=1 + - --otlp-attributes=service.name="test-{{ .DataType }}-daemonset" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + name: telemetrygen + restartPolicy: Always diff --git a/internal/testbed/integration/redaction/testdata/telemetrygen/deployment.yaml b/internal/testbed/integration/redaction/testdata/telemetrygen/deployment.yaml new file mode 100644 index 00000000..303ce30a --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/telemetrygen/deployment.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Name }}-{{ .DataType }}-deployment + namespace: e2eredaction +spec: + replicas: 1 + selector: + matchLabels: + app: {{ .Name }}-{{ .DataType }}-deployment + template: + metadata: + annotations: + workload: deployment + labels: + app: {{ .Name }}-{{ .DataType }}-deployment + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --duration=36000s + - --rate=1 + - --otlp-attributes=service.name="test-{{ .DataType }}-deployment" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + imagePullPolicy: IfNotPresent + name: telemetrygen + restartPolicy: Always diff --git a/internal/testbed/integration/redaction/testdata/telemetrygen/job.yaml b/internal/testbed/integration/redaction/testdata/telemetrygen/job.yaml new file mode 100644 index 00000000..ba08bb37 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/telemetrygen/job.yaml @@ -0,0 +1,25 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Name }}-{{ .DataType}}-job + namespace: e2eredaction +spec: + template: + metadata: + annotations: + workload: job + labels: + app: {{ .Name }}-{{ .DataType }}-job + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --rate=1 + - --duration=36000s + - --otlp-attributes=service.name="test-{{ .DataType }}-job" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + name: telemetrygen + restartPolicy: OnFailure diff --git a/internal/testbed/integration/redaction/testdata/telemetrygen/statefulset.yaml b/internal/testbed/integration/redaction/testdata/telemetrygen/statefulset.yaml new file mode 100644 index 00000000..1ce22bb5 --- /dev/null +++ b/internal/testbed/integration/redaction/testdata/telemetrygen/statefulset.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Name }}-{{ .DataType }}-statefulset + namespace: e2eredaction +spec: + serviceName: {{ .Name }}-{{ .DataType }}-statefulset + replicas: 1 + selector: + matchLabels: + app: {{ .Name }}-{{ .DataType }}-statefulset + template: + metadata: + annotations: + workload: statefulset + labels: + app: {{ .Name }}-{{ .DataType }}-statefulset + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --duration=36000s + - --rate=1 + - --otlp-attributes=service.name="test-{{ .DataType }}-statefulset" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + name: telemetrygen + restartPolicy: Always diff --git a/internal/testbed/testdata/config-allcomponents.yaml b/internal/testbed/testdata/config-allcomponents.yaml index 48522850..2594f871 100644 --- a/internal/testbed/testdata/config-allcomponents.yaml +++ b/internal/testbed/testdata/config-allcomponents.yaml @@ -43,6 +43,9 @@ receivers: endpoint: localhost:4318 processors: + redaction: + allow_all_keys: true + summary: info attributes: actions: - key: db.table diff --git a/manifest.yaml b/manifest.yaml index b17d448e..8d276655 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -33,6 +33,7 @@ processors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.107.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.107.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.107.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/redactionprocessor v0.107.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.107.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.107.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.107.0