Skip to content

Commit

Permalink
feature/actions: WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Aug 30, 2023
1 parent 334c2b8 commit ffa65f6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/tracing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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@v2

- 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 "::set-output name=trace::true"
else
echo "Enable tracing label not found."
echo "::set-output name=trace::false"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
telemetryTarget := os.Getenv("TELEMETRY_TARGET")

opts := make([]server.ServerOption, 0, 1)
if enableTelemetry == "true" {
if enableTelemetry == "true" && telemetryTarget != "" {
opts = append(opts, server.WithOpenTelemetry(telemetryTarget))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: "3"
services:

# Instrumented application configured to export traces to ...
example-grpc-server:
build:
context: ../../../
Expand All @@ -13,7 +14,7 @@ services:
- ENABLE_TELEMETRY=true
- TELEMETRY_TARGET=otel-collector:4317

# Put traces in a Grafana Agent pipeline...
# ... the OpenTelemetry Collector configured to receive traces and export to Tempo ...
otel-collector:
image: otel/opentelemetry-collector:0.61.0
command: [ "--config=/etc/otel-collector.yaml" ]
Expand All @@ -24,7 +25,7 @@ services:
depends_on:
- tempo

# To eventually offload to Tempo...
# .. Which accepts requests from grafana ...
tempo:
image: grafana/tempo:latest
command: [ "-config.file=/etc/tempo.yaml" ]
Expand Down
3 changes: 2 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ func (s *Server) Serve() {
s.grpcServer = grpc.NewServer(
grpc.UnaryInterceptor(
grpc_middleware.ChainUnaryServer(
otelgrpc.UnaryServerInterceptor(),
loggingUnaryServerInterceptor,
otelgrpc.UnaryServerInterceptor(),

),
),
)
Expand Down

0 comments on commit ffa65f6

Please sign in to comment.