-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
334c2b8
commit 21ce175
Showing
5 changed files
with
80 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Enable Tracing for PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, labeled, unlabeled, closed] | ||
|
||
jobs: | ||
tracing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for "enable tracing" label | ||
id: check-label | ||
run: | | ||
label=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH") | ||
if [[ "$label" == "enable tracing" ]]; then | ||
echo "Enable tracing label found." | ||
echo "trace=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "Enable tracing label not found." | ||
echo "trace=true" >> $GITHUB_OUTPUT | ||
fi | ||
echo "$PWD" | ||
- name: Setup Grafana and OpenTelemetry | ||
id: docker-setup | ||
if: steps.check-label.outputs.trace == 'true' | ||
run: | | ||
# Create network | ||
docker network create tracing_network | ||
# Start Grafana | ||
cd ./internal/examples/example-otlp-agent-tempo-grafana/ | ||
docker run -d --name=grafana -p 3000:3000 -v $PWD/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml -e GF_AUTH_ANONYMOUS_ENABLED=true -e GF_AUTH_ANONYMOUS_ORG_ROLE=Admin -e GF_AUTH_DISABLE_LOGIN_FORM=true -e GF_FEATURE_TOGGLES_ENABLE=traceqlEditor grafana/grafana:9.4.3 | ||
# Start Tempo | ||
docker run -d --network=tracing_network --name=tempo -v ./tempo.yaml:/etc/tempo.yaml -v $PWD/tempo-data:/tmp/tempo grafana/tempo:latest -config.file=/etc/tempo.yaml | ||
# Start OpenTelemetry Collector | ||
docker run -d --network=tracing_network --name=otel-collector -v $PWD/otel-collector.yaml:/etc/otel-collector.yaml -p 4317:4317 otel/opentelemetry-collector:0.61.0 --config=/etc/otel-collector.yaml | ||
- name: Build Example GRPC Server Docker Image | ||
if: steps.check-label.outputs.trace == 'true' | ||
run: | | ||
# Navigate to the directory containing the Dockerfile (note PWD resets for each step) | ||
cd ./internal/examples/example-grpc-client-server/server | ||
# Build the Docker image | ||
docker build -t example-grpc-server:latest -f Dockerfile.ci . | ||
- name: Start Example GRPC Server | ||
if: steps.check-label.outputs.trace == 'true' | ||
run: | | ||
docker run -d --network=tracing_network --name=example-grpc-server -p 50051:50051 -e ENABLE_TELEMETRY=true -e TELEMETRY_TARGET=otel-collector:4317 example-grpc-server:latest |
18 changes: 18 additions & 0 deletions
18
internal/examples/example-grpc-client-server/server/Dockerfile.ci
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM golang:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN ls -al | ||
|
||
RUN go mod download | ||
|
||
WORKDIR /app/internal/examples/example-grpc-client-server/server/ | ||
|
||
RUN go clean | ||
RUN go build -o server server_main.go | ||
RUN chmod +x server | ||
|
||
# CMD ["/bin/sh"] | ||
CMD ["./server"] |
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