Skip to content

Commit

Permalink
[processor/k8sattribute] e2e test support for metrics (#18916)
Browse files Browse the repository at this point in the history
Signed-off-by: Ziqi Zhao <[email protected]>
Co-authored-by: Dmitrii Anoshin <[email protected]>
  • Loading branch information
fatsheep9146 and dmitryax authored Mar 2, 2023
1 parent e61f8ba commit c9f6209
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 46 deletions.
16 changes: 16 additions & 0 deletions .chloggen/k8sattributes-e2e-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: k8sattributesprocessor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: k8sattributesprocessor e2e tests support metric data type.

# One or more tracking issues related to the change
issues: [18391]

# (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:
28 changes: 17 additions & 11 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,33 @@ jobs:
- name: check collector status
run: |
kubectl wait --for=condition=Ready --timeout=60s pod/test-opentelemetry-collector-0
- name: start telemetrygen job
- name: start telemetrygen job for trace, metric
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-job.yml
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f -
- name: check telemetrygen job status
run: |
kubectl wait --for=condition=Complete --timeout=60s job/test-telemetrygen-job
- name: start telemetrygen statefulset
kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-traces-job
kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-metrics-job
- name: start telemetrygen statefulset for trace, metric
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-statefulset.yml
- name: start telemetrygen deployment
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f -
- name: start telemetrygen deployment for trace, metric
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-deployment.yml
- name: start telemetrygen daemonset
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f -
- name: start telemetrygen daemonset for trace, metric
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-daemonset.yml
- name: wait telemetrygen statefulset/deployment/daemonset to generate trace
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f -
- name: wait telemetrygen statefulset/deployment/daemonset to generate trace and metric
run: |
sleep 30
- name: copy trace output
- name: copy telemetry trace, metric data output
run: |
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/trace.json processor/k8sattributesprocessor/testdata/trace.json
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/metric.json processor/k8sattributesprocessor/testdata/metric.json
- name: run e2e test to check output
run: |
cd processor/k8sattributesprocessor
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/e2e/k8s/collector-helm-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ config:
logging: {}
file/trace:
path: /tmp/trace.json
file/metric:
path: /tmp/metric.json
service:
pipelines:
traces:
exporters:
- file/trace

metrics:
exporters:
- file/metric

image:
repository: otel/opentelemetry-collector-contrib-dev
tag: "latest"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e/k8s/telemetrygen-daemonset.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: test-telemetrygen-daemonset
name: telemetrygen-DATA_TYPE-daemonset
spec:
selector:
matchLabels:
app: test-telemetrygen-daemonset
app: telemetrygen-DATA_TYPE-daemonset
template:
metadata:
annotations:
workload: daemonset
labels:
app: test-telemetrygen-daemonset
app: telemetrygen-DATA_TYPE-daemonset
spec:
containers:
- command:
- /telemetrygen
- traces
- DATA_TYPE
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-daemonset
- --duration=36000s
- --rate=1
- --otlp-attributes=service.name="test-daemonset"
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e/k8s/telemetrygen-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-telemetrygen-deployment
name: telemetrygen-DATA_TYPE-deployment
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test-telemetrygen-deployment
app: telemetrygen-DATA_TYPE-deployment
template:
metadata:
annotations:
workload: deployment
labels:
app: test-telemetrygen-deployment
app: telemetrygen-DATA_TYPE-deployment
spec:
containers:
- command:
- /telemetrygen
- traces
- DATA_TYPE
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-deployment
- --duration=36000s
- --rate=1
- --otlp-attributes=service.name="test-deployment"
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e/k8s/telemetrygen-job.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
apiVersion: batch/v1
kind: Job
metadata:
name: test-telemetrygen-job
name: telemetrygen-DATA_TYPE-job
namespace: default
spec:
template:
metadata:
annotations:
workload: job
labels:
app: test-telemetrygen
app: telemetrygen-DATA_TYPE
spec:
containers:
- command:
- /telemetrygen
- traces
- DATA_TYPE
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-job
- --traces=5
- --DATA_TYPE=5
- --rate=1
- --otlp-attributes=service.name="test-job"
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e/k8s/telemetrygen-statefulset.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-telemetrygen-statefulset
name: telemetrygen-DATA_TYPE-statefulset
namespace: default
spec:
serviceName: test-telemetrygen-statefulset
serviceName: telemetrygen-DATA_TYPE-statefulset
replicas: 1
selector:
matchLabels:
app: test-telemetrygen-statefulset
app: telemetrygen-DATA_TYPE-statefulset
template:
metadata:
metadata:
annotations:
workload: statefulset
labels:
app: test-telemetrygen-statefulset
app: telemetrygen-DATA_TYPE-statefulset
spec:
containers:
- command:
- /telemetrygen
- traces
- DATA_TYPE
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-statefulset
- --duration=36000s
- --rate=1
- --otlp-attributes=service.name="test-statefulset"
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
Expand Down
Loading

0 comments on commit c9f6209

Please sign in to comment.