Skip to content

Commit

Permalink
docs(getstarted): add beyla for Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanrahic committed Oct 15, 2024
1 parent f99c87f commit 9054762
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 6 deletions.
48 changes: 48 additions & 0 deletions docs/docs/getting-started/configure-trace-ingestion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,54 @@ rails server -p 8080
[Visit the example in GitHub, here.](https://github.com/kubeshop/tracetest/tree/main/examples/getting-started/ruby)
:::

</TabItem>
<TabItem value="docker" label="Docker">

You can configure [Grafana Beyla](https://grafana.com/oss/beyla-ebpf/) to autoinstrument Docker services and export traces to Tracetest.

1. Add Beyla to your `docker-compose.yaml`

```yaml title="docker-compose.yaml"
services:
autoinstrument:
image: grafana/beyla:latest
privileged: true
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://<tracetest-agent>:4317"
# OTEL_EXPORTER_OTLP_HEADERS: "x-tracetest-token:<token>"
BEYLA_OPEN_PORT: "3000,8080" # Beyla will autoinstrument services on these ports
BEYLA_TRACE_PRINTER: "text"

# ...
```

2. Add `pid: service:autoinstrument` to services in `docker-compose.yaml`

```yaml title="docker-compose.yaml"
services:
# ...

service1:
pid: service:autoinstrument # Add this line for Beyla to know what to instrument
build: ./service1
ports:
- "3000:3000"

service2:
pid: service:autoinstrument # Add this line for Beyla to know what to instrument
build: ./service2
ports:
- "8080:8080"
```
3. Run Docker Compose
```bash title="Terminal"
docker compose up
```

This will automatically instrument your Docker Compose services with Beyla using eBPF and send the traces to Tracetest.

</TabItem>
<TabItem value="opentelemetry-operator" label="Kubernetes" default>

Expand Down
18 changes: 18 additions & 0 deletions examples/getting-started/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
autoinstrument:
image: grafana/beyla:latest
privileged: true
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://host.docker.internal:4317"
# OTEL_EXPORTER_OTLP_HEADERS: "x-tracetest-token:<token>"
BEYLA_OPEN_PORT: "8080" # Beyla will autoinstrument services on these ports
BEYLA_TRACE_PRINTER: "text"
BEYLA_BPF_TRACK_REQUEST_HEADERS: "true"
extra_hosts:
- "host.docker.internal:host-gateway"

app:
pid: service:autoinstrument # Add this line for Beyla to know what to instrument
image: adnanrahic/hello-world-nodejs
ports:
- 8080:8080
2 changes: 1 addition & 1 deletion examples/quick-start-nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "npm", "run", "with-grpc-tracer" ]
CMD [ "npm", "start" ]
7 changes: 3 additions & 4 deletions examples/quick-start-nodejs/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
version: "3"
services:
app:
image: quick-start-nodejs
image: adnanrahic/hello-world-nodejs
extra_hosts:
- "host.docker.internal:host-gateway"
build: .
Expand All @@ -28,7 +28,7 @@ services:
# Get the required information here: https://app.tracetest.io/retrieve-token
- TRACETEST_API_KEY=${TRACETEST_TOKEN}
- TRACETEST_ENVIRONMENT_ID=${TRACETEST_ENVIRONMENT_ID}

tracetest-apply:
build:
dockerfile: Dockerfile.tracetest
Expand Down Expand Up @@ -64,4 +64,3 @@ services:
depends_on:
tracetest-apply:
condition: service_completed_successfully

3 changes: 2 additions & 1 deletion examples/quick-start-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"with-grpc-tracer-and-env": "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 node -r ./tracing.otel.grpc.js app.js",
"with-grpc-tracer": "node -r ./tracing.otel.grpc.js app.js",
"with-http-tracer": "node -r ./tracing.otel.http.js app.js"
"with-http-tracer": "node -r ./tracing.otel.http.js app.js",
"start": "node app.js"
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit 9054762

Please sign in to comment.