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

Add support to generate OTEL logs in generate script #973

Merged
merged 14 commits into from
Jan 7, 2025
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
2 changes: 1 addition & 1 deletion docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
extra_hosts:
- 'host.docker.internal:host-gateway'
loki:
image: grafana/loki:3.2.0
image: grafana/loki:3.3.2
environment:
LOG_CLUSTER_DEPTH: '8'
LOG_SIM_TH: '0.3'
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
extra_hosts:
- 'host.docker.internal:host-gateway'
loki:
image: grafana/loki:3.3.0
image: grafana/loki:3.3.2
environment:
LOG_CLUSTER_DEPTH: '8'
LOG_SIM_TH: '0.3'
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
extra_hosts:
- 'host.docker.internal:host-gateway'
loki:
image: grafana/loki:3.2.0
image: grafana/loki:3.3.2
environment:
LOG_CLUSTER_DEPTH: '8'
LOG_SIM_TH: '0.3'
Expand Down
29 changes: 27 additions & 2 deletions generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
# Start with the OTEL collector stage
FROM otel/opentelemetry-collector-contrib:latest AS collector

# Final stage
FROM golang:1.22

# Copy the collector binary from the collector stage
COPY --from=collector /otelcol-contrib /otelcol-contrib

WORKDIR /go/src/app

# Copy and build the log generator
COPY go.mod go.sum ./
COPY *.go ./
COPY flog/ flog/
COPY log/ log/

RUN go mod download

RUN CGO_ENABLED=0 GOOS=linux go build -o /generator

ENTRYPOINT ["/generator"]
# Copy the OTEL collector config
COPY otel-config.yaml /etc/otel/config.yaml

# Create a startup script
COPY <<EOF /start.sh
#!/bin/sh
# Start the OTEL collector in the background
/otelcol-contrib --config /etc/otel/config.yaml &

# Wait a bit for collector to start
sleep 2

# Start the log generator
/generator \$@
EOF

RUN chmod +x /start.sh

ENTRYPOINT ["/start.sh"]
Loading
Loading