-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to generate OTEL logs in generate script (#973)
* refactor: refactor generator implementation * chore: modify dockerfile to start otel-collector * chore: get go otel dependencies * fixup! chore: modify dockerfile to start otel-collector * chore: implement otel logging * chore: fix a few minor bugs * chore: update spellcheck * chore: add some more log types * chore: fix spellcheck * chore: upgrade loki versions in docker-compose files * fix: pass arguments to the generator inside dockerfile * fix: run generate-logs in docker * chore: change otel-config to use host.docker.internal Co-authored-by: Sven Grossmann <[email protected]> --------- Co-authored-by: Galen <[email protected]> Co-authored-by: Sven Grossmann <[email protected]> Co-authored-by: Galen Kistler <[email protected]>
- Loading branch information
1 parent
2f7ad5b
commit e07929a
Showing
15 changed files
with
488 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
Oops, something went wrong.