Observability middleware for gin-gonic/gin: Examples
This repository contains an example of using the package github.com/twistingmercury/monitoring
Prerequisites
- Go 1.21.x
- Docker and Docker Compose
- Python v3.x
- The latest Datadog Agent Docker image
- A Datadog account
About
The intent of this examples is to roughly simulate running the DD agent as a side car in a Kubernetes pod, without the need of using minikube locally.
- The OTel Collector could be used in place of DD agent for traces.
- Prometheus/Grafana could be used to scrape metrics instead of the DD agent.
- Any other tool, like Vector, FluentBit, etc., that can read stdout from a container could be used for logs instead of the DD agent.
This example creates a docker image using Alpine, via a multistage build.
- The Datadog Agent is configured to expose OTel ports in the docker-compose.yaml file.
- The volume mapping enables the agent to read the logs from the monex container's stout.
- In dockerfile, the following labels permit the agent to scrape prometheus metrics:
The intent of this examples is to roughly simulate running the DD Agent as a side car.
Running the example
make run
, or alternatively docker compose up
A python script is provided so that the endpoint is called continuouly to exercise the example service here:testclient.py.
make client
, or alternatively python3 ./testclient/client.py