Skip to content

Commit ee8d7e5

Browse files
chore: add a test for common scenarios (#31)
1 parent 7e3f0de commit ee8d7e5

35 files changed

Lines changed: 588 additions & 455 deletions

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
- name: Set up Docker Buildx
2424
uses: docker/setup-buildx-action@v3
2525
- name: Build binaries
26-
run: make build/lrap_x86_64 build/lrap_aarch64
26+
run: make build/dash0_x86_64 build/dash0_aarch64
2727
- uses: actions/upload-artifact@v4
2828
with:
2929
name: rust-binaries
3030
path: |
31-
build/lrap_x86_64
32-
build/lrap_aarch64
31+
build/dash0_x86_64
32+
build/dash0_aarch64

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
name: rust-binaries
3232
path: build
3333
- name: Ensure binaries are executable and fresh
34-
run: chmod +x build/lrap_x86_64 build/lrap_aarch64 && touch build/lrap_x86_64 build/lrap_aarch64
34+
run: chmod +x build/dash0_x86_64 build/dash0_aarch64 && touch build/dash0_x86_64 build/dash0_aarch64
3535
- uses: aws-actions/configure-aws-credentials@v4
3636
with:
3737
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
@@ -57,7 +57,7 @@ jobs:
5757
name: rust-binaries
5858
path: build
5959
- name: Ensure binaries are executable and fresh
60-
run: chmod +x build/lrap_x86_64 build/lrap_aarch64 && touch build/lrap_x86_64 build/lrap_aarch64
60+
run: chmod +x build/dash0_x86_64 build/dash0_aarch64 && touch build/dash0_x86_64 build/dash0_aarch64
6161
- uses: aws-actions/configure-aws-credentials@v4
6262
with:
6363
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
@@ -80,7 +80,7 @@ jobs:
8080
name: rust-binaries
8181
path: build
8282
- name: Ensure binaries are executable and fresh
83-
run: chmod +x build/lrap_x86_64 build/lrap_aarch64 && touch build/lrap_x86_64 build/lrap_aarch64
83+
run: chmod +x build/dash0_x86_64 build/dash0_aarch64 && touch build/dash0_x86_64 build/dash0_aarch64
8484
- uses: aws-actions/configure-aws-credentials@v4
8585
with:
8686
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
@@ -103,7 +103,7 @@ jobs:
103103
name: rust-binaries
104104
path: build
105105
- name: Ensure binaries are executable and fresh
106-
run: chmod +x build/lrap_x86_64 build/lrap_aarch64 && touch build/lrap_x86_64 build/lrap_aarch64
106+
run: chmod +x build/dash0_x86_64 build/dash0_aarch64 && touch build/dash0_x86_64 build/dash0_aarch64
107107
- uses: aws-actions/configure-aws-credentials@v4
108108
with:
109109
role-to-assume: ${{ vars.AWS_ROLE_ARN }}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ This package uses *Make* to build binary executables for *aarch64* and *x86_64*
2020
### Building and Deploying the Extension Layer
2121

2222
With the dependencies installed, run `make` in the base directory
23-
to compile the binaries. The executables and are copied into `build/`. The extension entrypoint script (`opt/entrypoint`) is copied to `build/extensions/lrap`
23+
to compile the binaries. The executables and are copied into `build/`. The extension entrypoint script (`opt/entrypoint`) is copied to `build/extensions/dash0`

Makefile

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
ZIP_NAME_PYTHON = layer-lrap-python.zip
2-
ZIP_NAME_NODE = layer-lrap-node.zip
3-
ZIP_NAME_JAVA = layer-lrap-java.zip
4-
ZIP_NAME_MANUAL = layer-lrap-manual.zip
1+
ZIP_NAME_PYTHON = layer-dash0-python.zip
2+
ZIP_NAME_NODE = layer-dash0-node.zip
3+
ZIP_NAME_JAVA = layer-dash0-java.zip
4+
ZIP_NAME_MANUAL = layer-dash0-manual.zip
55
LAYER_NAME_PREFIX ?=
66
LAYER_NAME_PYTHON = $(LAYER_NAME_PREFIX)dash0-extension-python
77
LAYER_NAME_NODE = $(LAYER_NAME_PREFIX)dash0-extension-node
@@ -12,7 +12,7 @@ LAMBDA_LAYER_MARKER_NODE := .lambda-layer-node
1212
LAMBDA_LAYER_MARKER_JAVA := .lambda-layer-java
1313
LAMBDA_LAYER_MARKER_MANUAL := .lambda-layer-manual
1414
CARGO_FEATURES :=
15-
PYTHON_DEPS_IMAGE := lrap-python-deps
15+
PYTHON_DEPS_IMAGE := dash0-python-deps
1616

1717
# Docker/ECR image settings
1818
AWS_ACCOUNT_ID := $(shell aws sts get-caller-identity --query Account --output text)
@@ -51,17 +51,17 @@ clean-build:
5151
clean-cargo:
5252
@cargo clean
5353

54-
build/lrap_x86_64: $(RS_FILES) Cargo.toml
54+
build/dash0_x86_64: $(RS_FILES) Cargo.toml
5555
@echo Building Rust application for x86_64
5656
@mkdir -p build
5757
@cross build --release --target x86_64-unknown-linux-musl ${CARGO_FEATURES}
58-
@cp target/x86_64-unknown-linux-musl/release/aws-lambda-runtime-api-proxy-rs build/lrap_x86_64
58+
@cp target/x86_64-unknown-linux-musl/release/aws-lambda-runtime-api-proxy-rs build/dash0_x86_64
5959

60-
build/lrap_aarch64: $(RS_FILES) Cargo.toml
60+
build/dash0_aarch64: $(RS_FILES) Cargo.toml
6161
@echo Building Rust application for aarch64
6262
@mkdir -p build
6363
@cross build --release --target aarch64-unknown-linux-musl ${CARGO_FEATURES}
64-
@cp target/aarch64-unknown-linux-musl/release/aws-lambda-runtime-api-proxy-rs build/lrap_aarch64
64+
@cp target/aarch64-unknown-linux-musl/release/aws-lambda-runtime-api-proxy-rs build/dash0_aarch64
6565

6666
PYTHON_DISTRO_SRC := $(shell find opt/python/distro/src -type f)
6767
NODE_DISTRO_SRC := $(shell find opt/node/distro/src -type f)
@@ -77,28 +77,28 @@ build/python: opt/python/distro/requirements.txt opt/python/Dockerfile $(PYTHON_
7777

7878

7979

80-
build/$(ZIP_NAME_PYTHON): build/lrap_x86_64 build/lrap_aarch64 opt/entrypoint opt/shared.sh opt/python/wrapper opt/python/otel_wrapper.py build/python
80+
build/$(ZIP_NAME_PYTHON): build/dash0_x86_64 build/dash0_aarch64 opt/entrypoint opt/shared.sh opt/python/wrapper opt/python/otel_wrapper.py build/python
8181
@rm -f build/$(ZIP_NAME_PYTHON)
8282
@rm -rf build/stage-python
8383
@mkdir -p build/stage-python/extensions
84-
@cp build/lrap_x86_64 build/stage-python/
85-
@cp build/lrap_aarch64 build/stage-python/
86-
@cp opt/entrypoint build/stage-python/extensions/lrap
84+
@cp build/dash0_x86_64 build/stage-python/
85+
@cp build/dash0_aarch64 build/stage-python/
86+
@cp opt/entrypoint build/stage-python/extensions/dash0
8787
@cp opt/shared.sh build/stage-python/shared.sh
8888
@cp opt/python/wrapper build/stage-python/wrapper
8989
@cp -r build/python build/stage-python/python
9090
@cp opt/python/otel_wrapper.py build/stage-python/python/otel_wrapper.py
9191
@cd build/stage-python && zip -r ../$(ZIP_NAME_PYTHON) *
9292

9393

94-
build/$(ZIP_NAME_NODE): build/lrap_x86_64 build/lrap_aarch64 opt/entrypoint opt/shared.sh opt/node/package.json opt/node/wrapper opt/node/webpack.config.mjs opt/node/init.mjs $(NODE_DISTRO_SRC)
94+
build/$(ZIP_NAME_NODE): build/dash0_x86_64 build/dash0_aarch64 opt/entrypoint opt/shared.sh opt/node/package.json opt/node/wrapper opt/node/webpack.config.mjs opt/node/init.mjs $(NODE_DISTRO_SRC)
9595
@echo Building Node.js layer
9696
@rm -f build/$(ZIP_NAME_NODE)
9797
@rm -rf build/stage-node
9898
@mkdir -p build/stage-node/extensions
99-
@cp build/lrap_x86_64 build/stage-node/
100-
@cp build/lrap_aarch64 build/stage-node/
101-
@cp opt/entrypoint build/stage-node/extensions/lrap
99+
@cp build/dash0_x86_64 build/stage-node/
100+
@cp build/dash0_aarch64 build/stage-node/
101+
@cp opt/entrypoint build/stage-node/extensions/dash0
102102
@cp opt/shared.sh build/stage-node/shared.sh
103103
@cp opt/node/wrapper build/stage-node/wrapper
104104
@bash opt/node/scripts/build-aws-sdk-tarball.sh
@@ -124,30 +124,30 @@ $(JAVA_DISTRO_JAR): $(JAVA_DISTRO_SRC)
124124
@echo Building Java distro
125125
@cd opt/java/opentelemetry-java-distro && ./gradlew clean -Pversion=1.0.0-SNAPSHOT assemble -x javadoc
126126

127-
build/$(ZIP_NAME_JAVA): build/lrap_x86_64 build/lrap_aarch64 opt/entrypoint opt/shared.sh opt/java/wrapper $(JAVA_DISTRO_JAR)
127+
build/$(ZIP_NAME_JAVA): build/dash0_x86_64 build/dash0_aarch64 opt/entrypoint opt/shared.sh opt/java/wrapper $(JAVA_DISTRO_JAR)
128128
@echo Building Java layer
129129
@rm -f build/$(ZIP_NAME_JAVA)
130130
@rm -rf build/stage-java
131131
@mkdir -p build/stage-java/extensions
132132
@mkdir -p build/stage-java/java/lib
133-
@cp build/lrap_x86_64 build/stage-java/
134-
@cp build/lrap_aarch64 build/stage-java/
135-
@cp opt/entrypoint build/stage-java/extensions/lrap
133+
@cp build/dash0_x86_64 build/stage-java/
134+
@cp build/dash0_aarch64 build/stage-java/
135+
@cp opt/entrypoint build/stage-java/extensions/dash0
136136
@cp opt/shared.sh build/stage-java/shared.sh
137137
@cp opt/java/wrapper build/stage-java/wrapper
138138
@cp $(JAVA_DISTRO_JAR) build/stage-java/java/lib/dash0-opentelemetry.jar
139139
@cp $(JAVA_CLASSPATH_LIBS_DIR)/*.jar build/stage-java/java/lib/
140140
@cd build/stage-java && zip -r ../$(ZIP_NAME_JAVA) *
141141

142142

143-
build/$(ZIP_NAME_MANUAL): build/lrap_x86_64 build/lrap_aarch64 opt/entrypoint opt/shared.sh opt/manual/wrapper
143+
build/$(ZIP_NAME_MANUAL): build/dash0_x86_64 build/dash0_aarch64 opt/entrypoint opt/shared.sh opt/manual/wrapper
144144
@echo Building Manual layer
145145
@rm -f build/$(ZIP_NAME_MANUAL)
146146
@rm -rf build/stage-manual
147147
@mkdir -p build/stage-manual/extensions
148-
@cp build/lrap_x86_64 build/stage-manual/
149-
@cp build/lrap_aarch64 build/stage-manual/
150-
@cp opt/entrypoint build/stage-manual/extensions/lrap
148+
@cp build/dash0_x86_64 build/stage-manual/
149+
@cp build/dash0_aarch64 build/stage-manual/
150+
@cp opt/entrypoint build/stage-manual/extensions/dash0
151151
@cp opt/shared.sh build/stage-manual/shared.sh
152152
@cp opt/manual/wrapper build/stage-manual/wrapper
153153
@cd build/stage-manual && zip -r ../$(ZIP_NAME_MANUAL) *
@@ -225,7 +225,7 @@ ensure-buildx:
225225

226226
# Build and push Docker image for Python extension to ECR
227227
# Usage: make docker-python VERSION=1.0.0
228-
docker-python: build/lrap_x86_64 build/lrap_aarch64 build/python ensure-buildx
228+
docker-python: build/dash0_x86_64 build/dash0_aarch64 build/python ensure-buildx
229229
@echo "Creating ECR repository $(ECR_REPO_PYTHON) if it doesn't exist..."
230230
@aws ecr describe-repositories --repository-names $(ECR_REPO_PYTHON) 2>/dev/null || \
231231
aws ecr create-repository --repository-name $(ECR_REPO_PYTHON) --no-cli-pager
@@ -241,7 +241,7 @@ docker-python: build/lrap_x86_64 build/lrap_aarch64 build/python ensure-buildx
241241

242242
# Build and push Docker image for Node.js extension to ECR
243243
# Usage: make docker-node VERSION=1.0.0
244-
docker-node: build/lrap_x86_64 build/lrap_aarch64 ensure-buildx
244+
docker-node: build/dash0_x86_64 build/dash0_aarch64 ensure-buildx
245245
@echo "Building Node.js SDK..."
246246
@bash opt/node/scripts/build-aws-sdk-tarball.sh
247247
@cd opt/node && npm install && npm run build
@@ -260,7 +260,7 @@ docker-node: build/lrap_x86_64 build/lrap_aarch64 ensure-buildx
260260

261261
# Build and push Docker image for Java extension to ECR
262262
# Usage: make docker-java VERSION=1.0.0
263-
docker-java: build/lrap_x86_64 build/lrap_aarch64 $(JAVA_DISTRO_JAR) ensure-buildx
263+
docker-java: build/dash0_x86_64 build/dash0_aarch64 $(JAVA_DISTRO_JAR) ensure-buildx
264264
@echo "Creating ECR repository $(ECR_REPO_JAVA) if it doesn't exist..."
265265
@aws ecr describe-repositories --repository-names $(ECR_REPO_JAVA) 2>/dev/null || \
266266
aws ecr create-repository --repository-name $(ECR_REPO_JAVA) --no-cli-pager

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ See the release page for the latest ARNs of the extension layers for each runtim
4646

4747
* `DASH0_LOGS_INSTRUMENTATION_ENABLED` - When set to `true`, logs won't be collected from the Telemetry API, to prevent duplicates from the OTEL instrumentation. Default: `false`.
4848

49+
* `DASH0_DATASET` - When set, the extension adds a `Dash0-Dataset` header to all OTLP export requests, routing telemetry to the specified dataset in the Dash0 backend.
50+
4951
### Secret Masking
5052

5153
The extension automatically masks sensitive data in traces payloads. By default, any JSON key matching these patterns (case-insensitive) will have its value replaced with `****`:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import json
2+
3+
4+
def handler(event, context):
5+
print(f"Received event: {json.dumps(event)}")
6+
raise RuntimeError("Intentional error for retry testing")

integration-tests/iac/lib/python-tracing-scenarios-stack.ts

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -218,46 +218,51 @@ export class PythonTracingScenariosStack extends cdk.NestedStack {
218218
}));
219219

220220
// Scenario 5: Lambda > EventBridge > Lambda
221-
const eventBus = new events.EventBus(this, `TracingTestEventBus-${runtimeName}`, {
222-
eventBusName: `${prefix}tracing-test-event-bus-${runtimeName}`,
223-
});
224-
225-
const eventBridgeConsumer = new lambda.Function(this, `EventBridgeConsumerLambda-${runtimeName}`, {
226-
functionName: `${prefix}tracing-eventbridge-consumer-${runtimeName}`,
227-
runtime,
228-
handler: 'consumer.handler',
229-
code: pythonCode,
230-
layers: [props.layer],
231-
role,
232-
timeout: cdk.Duration.seconds(10),
233-
logGroup: props.logGroup,
234-
environment: baseEnvironment,
235-
});
236-
237-
new events.Rule(this, `TracingTestEventBridgeRule-${runtimeName}`, {
238-
ruleName: `${prefix}tracing-test-eventbridge-rule-${runtimeName}`,
239-
eventBus,
240-
eventPattern: {
241-
source: ['tracing-tests.producer'],
242-
detailType: ['TestMessage'],
243-
},
244-
targets: [new events_targets.LambdaFunction(eventBridgeConsumer)],
245-
});
246-
247-
const eventBridgeProducer = new lambda.Function(this, `EventBridgeProducerLambda-${runtimeName}`, {
248-
functionName: `${prefix}tracing-eventbridge-producer-${runtimeName}`,
249-
runtime,
250-
handler: 'eventbridge_producer.handler',
251-
code: pythonCode,
252-
layers: [props.layer],
253-
role,
254-
timeout: cdk.Duration.seconds(10),
255-
logGroup: props.logGroup,
256-
environment: {
257-
...baseEnvironment,
258-
EVENT_BUS_NAME: eventBus.eventBusName,
259-
},
260-
});
221+
for (const withError of [false, true]) {
222+
const errorSuffix = withError ? '-error' : '';
223+
const errorIdSuffix = withError ? 'Error' : '';
224+
225+
const eventBus = new events.EventBus(this, `TracingTestEventBus${errorIdSuffix}-${runtimeName}`, {
226+
eventBusName: `${prefix}tracing-test-event-bus${errorSuffix}-${runtimeName}`,
227+
});
228+
229+
const eventBridgeConsumer = new lambda.Function(this, `EventBridgeConsumerLambda${errorIdSuffix}-${runtimeName}`, {
230+
functionName: `${prefix}tracing-eventbridge-consumer${errorSuffix}-${runtimeName}`,
231+
runtime,
232+
handler: withError ? 'consumer_error.handler' : 'consumer.handler',
233+
code: pythonCode,
234+
layers: [props.layer],
235+
role,
236+
timeout: cdk.Duration.seconds(10),
237+
logGroup: props.logGroup,
238+
environment: baseEnvironment,
239+
});
240+
241+
new events.Rule(this, `TracingTestEventBridgeRule${errorIdSuffix}-${runtimeName}`, {
242+
ruleName: `${prefix}tracing-test-eventbridge-rule${errorSuffix}-${runtimeName}`,
243+
eventBus,
244+
eventPattern: {
245+
source: ['tracing-tests.producer'],
246+
detailType: ['TestMessage'],
247+
},
248+
targets: [new events_targets.LambdaFunction(eventBridgeConsumer)],
249+
});
250+
251+
const eventBridgeProducer = new lambda.Function(this, `EventBridgeProducerLambda${errorIdSuffix}-${runtimeName}`, {
252+
functionName: `${prefix}tracing-eventbridge-producer${errorSuffix}-${runtimeName}`,
253+
runtime,
254+
handler: 'eventbridge_producer.handler',
255+
code: pythonCode,
256+
layers: [props.layer],
257+
role,
258+
timeout: cdk.Duration.seconds(10),
259+
logGroup: props.logGroup,
260+
environment: {
261+
...baseEnvironment,
262+
EVENT_BUS_NAME: eventBus.eventBusName,
263+
},
264+
});
265+
}
261266

262267
// Scenario 6: Lambda > API Gateway > Lambda
263268
const apiGatewayConsumer = new lambda.Function(this, `ApiGatewayConsumerLambda-${runtimeName}`, {

0 commit comments

Comments
 (0)