Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(getstarted): add Beyla for Docker #4051

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 auto-instrument Docker services and export traces to Tracetest.

1. Add Beyla to your `docker-compose.yaml`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Add Beyla to your `docker-compose.yaml`
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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Add `pid: service:autoinstrument` to services in `docker-compose.yaml`
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Run Docker Compose
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
Loading