You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
0 commit comments