Skip to content

A Proof of Concept showcasing OpenTelemetry in a Go app with logs, traces, and metrics using Loki, Tempo, Prometheus, and Grafana. Built with Go, templ, htmx, SCSS using Air and esbuild, featuring real-time monitoring, hot reloading, and optimized bundling.

License

Notifications You must be signed in to change notification settings

FullKernelPanic/go-stack-yourself

Repository files navigation

Go stack yourself

This project is a Proof of Concept (PoC) aimed at demonstrating how to implement OpenTelemetry in a Go-based application. It integrates logs, traces, and metrics collection using Loki, Tempo, and Prometheus, visualized through Grafana. The backend is built using Go and templ, while the frontend leverages htmx and scss.

alt text


Tech Stack

The project consists of the following components:

  • Backend: Written in Go using templ.
  • Frontend: Built with HTML templates, htmx for dynamic interactions, and SCSS for styling. Bundled using esbuild.
  • Logs: Collected using Loki.
  • Traces: Managed using Tempo.
  • Metrics: Collected using Prometheus.
  • Visualization: Centralized on Grafana.

Features

  • Logs: Aggregated and stored in Loki.
  • Traces: OpenTelemetry-powered distributed tracing visualized in Grafana via Tempo.
  • Metrics: Collected from the Go application using Prometheus.
  • Real-time Monitoring: Visualize logs, traces, and metrics with Grafana's powerful UI.
  • Hot Reloading: Automatically rebuild the Go application inside the Docker container using Air.
  • Frontend Bundling: JavaScript and SCSS assets are bundled using esbuild for optimized performance.

Getting Started

Prerequisites

Before setting up the project, ensure you have the following tools installed:


Setup Instructions

  1. Clone the Repository:

    git clone [email protected]:FullKernelPanic/go-stack-yourself.git
    cd go-stack-yourself
  2. Build the Project:

    make build
  3. Start the Stack:

    make up
  4. Access the Application:

  1. Run Automated Tests:
    make run-tests

Development Workflow

The project is pre-configured to use Air inside the Docker container, which automatically monitors file changes and rebuilds the Go application. This ensures efficient development without requiring additional installation on the host machine.

The frontend assets (JavaScript and SCSS) are bundled and optimized using esbuild, which ensures fast builds and compatibility across modern browsers.


Architecture Overview

  1. Backend:
  • Written in Go.
  • Uses templ for HTML templates generation.
  1. Frontend:
  • Dynamically updates the UI using htmx.
  • Styled with SCSS. Bundled and optimized using esbuild.
  1. Instrumentation:
  • OpenTelemetry is configured to enable logs, traces, and metrics collection.
  1. Monitoring Components:
  • Logs are stored in Loki.
  • Distributed tracing is managed with Tempo.
  • Metrics data is gathered by Prometheus.
  • Grafana visualizes all the collected data for real-time monitoring.

Contributing

Contributions to improve this Proof of Concept are welcome! Feel free to submit issues or pull requests to help enhance the project.


License

This project is open-sourced under an appropriate LICENSE (update this section with a license type).


Acknowledgements

Special thanks to:

  • The OpenTelemetry community for enabling effortless observability.
  • The Go ecosystem for an excellent development experience.
  • Grafana, Loki, Tempo, and Prometheus for their robust monitoring tools.
  • esbuild for its blazing-fast JavaScript and SCSS bundling capabilities.

Contact

If you have any questions or feedback, feel free to open an issue or reach out!


Happy Monitoring!

About

A Proof of Concept showcasing OpenTelemetry in a Go app with logs, traces, and metrics using Loki, Tempo, Prometheus, and Grafana. Built with Go, templ, htmx, SCSS using Air and esbuild, featuring real-time monitoring, hot reloading, and optimized bundling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published