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
.
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.
- 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.
Before setting up the project, ensure you have the following tools installed:
-
Clone the Repository:
git clone [email protected]:FullKernelPanic/go-stack-yourself.git cd go-stack-yourself
-
Build the Project:
make build
-
Start the Stack:
make up
-
Access the Application:
- Web UI: http://localhost:8081/app/
- Grafana Dashboard: http://localhost:8081/grafana/
- Run Automated Tests:
make run-tests
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.
- Backend:
- Written in Go.
- Uses
templ
for HTML templates generation.
- Frontend:
- Dynamically updates the UI using
htmx
. - Styled with SCSS. Bundled and optimized using
esbuild
.
- Instrumentation:
- OpenTelemetry is configured to enable logs, traces, and metrics collection.
- 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.
Contributions to improve this Proof of Concept are welcome! Feel free to submit issues or pull requests to help enhance the project.
This project is open-sourced under an appropriate LICENSE (update this section with a license type).
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.
If you have any questions or feedback, feel free to open an issue or reach out!
Happy Monitoring!