Skip to content

Commit 755cad6

Browse files
cbb330Vibe Kanban
andauthored
Remove OTel agent from Docker images; use compose volume mounts instead (linkedin#478)
## Summary Fixes the Docker build failure introduced by the OTel agent COPY (linkedin#474's `ja[r]` glob trick still fails when `build/otel/` directory doesn't exist in the build context). The OTel Java agent should not be baked into production Docker images — it is only needed for ad-hoc local integration testing. This PR removes the agent from Docker images entirely and instead provides docker-compose override files to volume-mount it when needed. ## How builds work after this change | Scenario | OTel agent | How | |----------|-----------|-----| | **`./gradlew build`** (regular build) | Not downloaded | No OTel in build or images | | **CI** (`build-run-tests.yml`, `build-tag-publish.yml`) | Not downloaded | Docker images build cleanly without OTel | | **`./gradlew dockerPrereqs`** (local integration) | Downloaded to `build/otel/` | Available for volume-mounting into containers | | **Integration testing via docker-compose** | Volume-mounted at runtime | Use otel-profile compose overrides (see below) | ### Ad-hoc integration testing with tracing ```bash # Build JARs + download OTel agent ./gradlew dockerPrereqs # Start services with OTel agent volume-mounted docker compose \ -f infra/recipes/docker-compose/oh-only/docker-compose.yml \ -f infra/recipes/docker-compose/common/otel-profile/tables.yml \ -f infra/recipes/docker-compose/common/otel-profile/housetables.yml \ -f infra/recipes/docker-compose/common/otel-profile/jobs.yml \ up -d --build ``` `run.sh` already detects the agent at `./otel/opentelemetry-javaagent.jar` and attaches it automatically. Without the otel-profile overrides there is no JAR mounted, so `run.sh` skips it. ## Changes - Remove `COPY` of OTel agent JAR from all three service Dockerfiles - Remove `downloadOtelAgent` from CI `build-run-tests` workflow - Add `infra/recipes/docker-compose/common/otel-profile/` compose overrides that volume-mount the agent into each service container - Restore `otel_annotations_version` ext property and OTel annotation dependencies as `compileOnly` (needed at compile time for `@WithSpan`, not shipped in fat JARs) ## Test Plan - [ ] CI `build-run-tests` workflow passes (no OTel download, no Docker COPY) - [ ] CI `build-tag-publish` workflow passes (Docker images build without OTel) - [ ] Local `./gradlew dockerPrereqs && docker compose ... -f otel-profile/tables.yml up` attaches agent - [ ] Services start correctly without otel-profile overrides (no agent, no error) Co-authored-by: Vibe Kanban <noreply@vibekanban.com>
1 parent 41ab629 commit 755cad6

10 files changed

Lines changed: 23 additions & 10 deletions

File tree

.github/workflows/build-run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: gradle/actions/setup-gradle@v5
2222

2323
- name: Build with Gradle
24-
run: ./gradlew clean build downloadOtelAgent
24+
run: ./gradlew clean build
2525

2626
- name: Start Docker Containers
2727
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml up -d --build

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ext {
3333
iceberg_1_2_version = "1.2.0.6"
3434
iceberg_1_5_version = "1.5.2.7"
3535
otel_agent_version = "2.12.0" // Bundles OTel SDK 1.47.0
36+
otel_annotations_version = "2.12.0" // Match agent version
3637
}
3738

3839
// OpenTelemetry Java Agent for distributed tracing.

housetables-service.Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ RUN ls $APP_NAME.jar
3535

3636
COPY run.sh .
3737

38-
# OpenTelemetry Java Agent for distributed tracing (optional; run.sh attaches it only if present).
39-
# The [r] glob trick makes COPY a no-op when the file is absent, avoiding a hard build failure.
40-
COPY build/otel/opentelemetry-javaagent.ja[r] otel/
4138

4239
# Ensure that everything in $USER_HOME is owned by openhouse user
4340
RUN chown -R openhouse:openhouse $USER_HOME

iceberg/openhouse/internalcatalog/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ plugins {
1212
dependencies {
1313
implementation 'com.github.spotbugs:spotbugs-annotations:4.8.1'
1414
api 'org.springframework.retry:spring-retry:1.3.3'
15+
compileOnly "io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:${otel_annotations_version}"
16+
api 'io.opentelemetry:opentelemetry-api:1.47.0'
1517
api project(':client:hts')
1618
api project(':cluster:storage')
1719
api project(':cluster:metrics')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
openhouse-housetables:
3+
volumes:
4+
- ../../../../build/otel/opentelemetry-javaagent.jar:/home/openhouse/otel/opentelemetry-javaagent.jar:ro
5+
environment:
6+
- OTEL_SERVICE_NAME=openhouse-housetables
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
openhouse-jobs:
3+
volumes:
4+
- ../../../../build/otel/opentelemetry-javaagent.jar:/home/openhouse/otel/opentelemetry-javaagent.jar:ro
5+
environment:
6+
- OTEL_SERVICE_NAME=openhouse-jobs
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
openhouse-tables:
3+
volumes:
4+
- ../../../../build/otel/opentelemetry-javaagent.jar:/home/openhouse/otel/opentelemetry-javaagent.jar:ro
5+
environment:
6+
- OTEL_SERVICE_NAME=openhouse-tables

jobs-service.Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ RUN ls $APP_NAME.jar
3333

3434
COPY run.sh .
3535

36-
# OpenTelemetry Java Agent for distributed tracing (optional; run.sh attaches it only if present).
37-
# The [r] glob trick makes COPY a no-op when the file is absent, avoiding a hard build failure.
38-
COPY build/otel/opentelemetry-javaagent.ja[r] otel/
3936

4037
# Ensure that everything in $USER_HOME is owned by openhouse user
4138
RUN chown -R openhouse:openhouse $USER_HOME

services/tables/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ openApi {
3131
}
3232

3333
dependencies {
34+
compileOnly "io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:${otel_annotations_version}"
3435
api project(':services:common')
3536
api project(':iceberg:openhouse:internalcatalog')
3637
api project(':client:hts')

tables-service.Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ RUN ls $APP_NAME.jar
3535

3636
COPY run.sh .
3737

38-
# OpenTelemetry Java Agent for distributed tracing (optional; run.sh attaches it only if present).
39-
# The [r] glob trick makes COPY a no-op when the file is absent, avoiding a hard build failure.
40-
COPY build/otel/opentelemetry-javaagent.ja[r] otel/
4138

4239
# Ensure that everything in $USER_HOME is owned by openhouse user
4340
RUN chown -R openhouse:openhouse $USER_HOME

0 commit comments

Comments
 (0)