at on 1. A i i e n w o d ’t v k n c u a t d n t r d . 2. M i e n, w o c t r t c g t n m e u h t n m o . 4 O e i n 4 A -i e n - s e .N , J , J , P , P , d m L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 5
8 D e O B 4 I o d t A , F , G , k , e . p y : 4 A e A -A R m (O M ) 4 T s f d e (O T ) 4 T d e o i c (t a s ) 4 T s L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 7
2. s g : group=$(trace group start "some-name") 3. r p e i a g : trace task "${group}" -- some command here 4. n h g trace group finish "${group}" 5. n h t trace finish L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
apikey: ${{ secrets.BUILDEVENT_APIKEY }} dataset: gha-buildevents_integration status: ${{ job.status }} - name: Check out repo uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: go-version-file: 'go.mod' - run: |- STEP_ID=setup-go STEP_START=$(date +%s) go version buildevents step $TRACE_ID $STEP_ID $STEP_START $STEP_ID ... 4 G l - b .y L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
$STEP_ID $STEP_START $STEP_NAME 4 $TRACE_ID - e c h c a h l w o c . i v e a i e h H m g -b e A . 4 $STEP_ID - e a u i e o c s . I ’s s a s , u a o h r c a s , i ’s s s n s i e m v e. 4 $STEP_START - A t m h f e m (s s 1 -1-1 U ). e b e c t h t d n c s . o e s i e m v e i i a r c e s h o a h e c e . 4 $STEP_NAME - A h -r e m o h s . i m l e e d i h t e e q g u t d . I ’s p e s h m v STEP_ID, h I e a h -r e w . L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
b il s ep buildevents cmd $TRACE_ID $STEP_ID $CMD_NAME -- $CMD 4 $TRACE_ID n $STEP_ID` r u e . b t h -r e n a u i e . 4 $STEP_NAME s u $CMD_NAME. m n h m e t o 4 $CMD a a w d n c s n l c e . B d , h c l e d i /bin/bash -c. 4 f e o h m L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
ha f il 4 b d e a i d 't o t 4 d i h b e o h o b e c w c g . 4 F , h d b r G A o h r n w o f . - id: "Honeycomb: Finalize pact-credit-score" if: always() run: buildevents step $TRACE_ID $STEP_ID $STEP_START $STEP_ID L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
"a " s l u e n s , e t a r s u a p s f . T r , o n d n r c w c n o l n a e e t H m e h d n o a r . 4 T a t , h f n d l a u h n s , u u h e c l n h a h r t r e a u t c i - id: "Honeycomb: Finalize pact-credit-score" if: always() env: OUTCOME: ${{ steps.pact-credit-score.outcome }} run: | if echo $OUTCOME | grep -wq -e success -e failure; then buildevents step $TRACE_ID $STEP_ID $STEP_START $STEP_ID fi L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
u w o : 4 M c i i b e e t w n a s . 4 E n a t c p s b e u i : always(). 4 U h o h w e c o n a n s . 4 A v e h s b s $GITHUB_ENV. L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 1
server tui otel-desktop-viewer 4 s m e v (H m , L e , E ) export LIGHTSTEP_TOKEN= # Lightstep API key (otlp/1 in the yaml) export HONEYCOMB_TEAM= # Honeycomb API key (otlp/2 in the yaml) export HONEYCOMB_DATASET=playground # Honeycomb dataset export ELASTIC_TOKEN= # Elastic token for the APM server. 4 r a p i a s 4 p t c i e o a c c c s 4 f a d c o a s a a h b u , n d e i , n c l u s L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 2
send to our desktop viewer endpoint export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 # use otel-cli to generate spans! otel-cli exec --service my-service --name "curl blog" curl https://www.prskavec.net L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 2
... "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ... ) L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 2
( tracer = otel.GetTracerProvider().Tracer( instrumentationName, trace.WithInstrumentationVersion(instrumentationVersion), trace.WithSchemaURL(semconv.SchemaURL), ) sc trace.SpanContext ) L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 2
, e func build(ctx context.Context, repoUrl string) error { ctx, span = tracer.Start(ctx, "initDagger") span.AddEvent("start init dagger") span.SetAttributes(attribute.Bool("cache", true)) client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout)) if err != nil { span.SetStatus(codes.Error, err.Error()) span.RecordError(err) return err 4 d 't f c h a span.End() b defer span.End() L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 3
export OTEL_TRACES_EXPORTER="otlp" export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf" otel-desktop-viewer 4 s c L v P c, r S (@a @h r .i ) - C N #5, 2 . e 2 3