Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active May 26, 2025 15:32
Show Gist options
  • Save StevenACoffman/78e73148f507c1441acefa2ca3ad5b8f to your computer and use it in GitHub Desktop.
Save StevenACoffman/78e73148f507c1441acefa2ca3ad5b8f to your computer and use it in GitHub Desktop.
Wide Events and Cannonical Log Lines for Go
  • https://www.honeycomb.io/blog/structured-events-basis-observability

  • An event is a conceptual abstraction and a structured log is one possible representation of that abstraction. The interesting part of the conversation is where to draw the lines around that abstraction; the technical implementation part is how to represent that event.

  • Explicit propagation requires explicitly passing the active context from function to function as an argument (Go).

For distributed context propagation, OpenTelemetry supports several protocols that define how to serialize and pass context data:

canonical_log_line http_method=GET http_path=/v1/clusters duration=0.050 db_duration=0.045 db_num_queries=3 user=usr_123 status=200

https://signoz.io/guides/zap-logger/

https://github.com/GoogleCloudPlatform/microservices-demo

https://github.com/uptrace/opentelemetry-go-extra/tree/main/otelzap

Logging systems can’t afford to store data about every transaction anymore because the cost of those transactional logs is proportional to the number of microservices touched by an average transaction. Not to mention that the logs themselves are less useful (independent of cost) due to the analytical need to understand concurrency and causality in microservice transactions. So conventional logging isn’t sufficient in our brave new architectural world.

https://web.archive.org/web/20190213162559/https://lightstep.com/blog/three-pillars-zero-answers-towards-new-scorecard-observability/

https://github.com/mreider/sushi0/blob/ec2bdd964ef7aba133bf6a39c5ae05f28cf2a3f7/.github/workflows/deploy-things.yml#L23

    - name: End Docker Buildx
      run: |
        time_end=$(date +%Y-%m-%dT%H:%M:%S.%NZ)
        if [ "$GITHUB_EVENT_NAME" = "repository_dispatch" ]; then
          otel-cli span create \
          --endpoint=${{ secrets.DYNATRACE_ENDPOINT }}/api/v2/otlp/v1/traces \
          --otlp-headers="Authorization=Api-Token ${{ secrets.DYNATRACE_TOKEN}}" \
          --service=workflow \
          --name="Docker Build" \
          --force-parent-span-id=${{ env.parent_span_id }} \
          --start=${{ env.docker_time_start }}  \
          --end=$time_end \
          --kind=internal \
          --force-trace-id=${{ env.trace_id }} \
          --status-code="ok" \
          --status-description="Docker Built Successfully" \
          --verbose
        fi
        echo "deploy_time_start=$(date +%Y-%m-%dT%H:%M:%S.%NZ)" >> $GITHUB_ENV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment