go-backend-app

command module
v0.0.0-...-3f5ce87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 1 Imported by: 0

README

go-backend-app

Template for a Go backend app with OpenAPI and OpenTelemetry metrics/tracing.

Development

Docker Compose

App dependencies can be run locally using Docker Compose.

OpenAPI codegen

The api directory contains the OpenAPI spec and tools for generating the API client and server. Once changes have been made to the OpenAPI spec, you can generate the complete API spec and the API server code by running make generate.

Observability

Debug/profiling

This template includes a separate debug HTTP server that exposes pprof for profiling app CPU usage, goroutines, heap, mutexes, and more.

Metrics

This template uses OpenTelemetry metrics for collecting metrics. It comes with a built-in Prometheus metrics server that exposes the metrics for scraping.

Logging

This template uses Zap for logging. In development mode, the logs will be written to the console in a human-friendly format. In production, logs are written to the console in JSON format for easy parsing.

The log level can be changed at runtime by calling the /debug/log/level endpoint on the debug server using Zap's AtomicLevel API.

Tracing

This template uses OpenTelemetry tracing for collecting traces. It comes with a built-in exporter that can be configured to send traces to any OTLP-compatible collector.

For demonstration purposes, it comes with a Jaeger all-in-one server that can be run locally. Traces can be viewed in the Jaeger UI at http://localhost:16686.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
app
cmd
generated/api
Code generated by ogen, DO NOT EDIT.
Code generated by ogen, DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL