Skip to content

Introduction

This site shows how to create a Go app that has logs, metrics and traces visible in Grafana. The Grafana datasources are configured to ensure a seamless click-through experience between each of these signals. The implementation of metrics and traces within the app makes use of OpenTelemetry-Go, and logging uses the log/slog package that was introduced in Go 1.21.

The site is backed by a fully-working demo, so you can easily run it up and explore how to navigate around. This also means you have a complete reference for how to implement things yourself – many other examples online exist only as small fragments, often requiring you to read a bunch of other docs before you have enough to get that *!&$@% thing working.

The demo consists of:

  • Some application components:
    • GRPC server
    • worker service which receives messages from the GRPC server over NATS
    • command-line app to post requests to the GRPC server
  • Various infra services:
    • Grafana – including provisioned datasources and dashboards
    • Loki/Promtail
    • Tempo
    • Prometheus
    • NATS

The request flow between the different application components is super simple:

uml diagram