https://github.com/petems/datadog-golang-apm-example
Simple golang docker-compose example for Datadog APM
https://github.com/petems/datadog-golang-apm-example
Last synced: 4 months ago
JSON representation
Simple golang docker-compose example for Datadog APM
- Host: GitHub
- URL: https://github.com/petems/datadog-golang-apm-example
- Owner: petems
- Created: 2024-05-01T15:07:14.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-01T15:15:44.000Z (about 1 year ago)
- Last Synced: 2025-01-12T16:37:49.447Z (6 months ago)
- Language: Go
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Go app
A basic Golang app for demoing Golang APM. It's a very simple app that runs several endpoints to trigger specific APM scenarios (errors, spans, tags, errors etc)
## Running
You need DD_API_KEY set in your shell environment.
On OSX, consider https://github.com/sorah/envchain (eg. `envchain datadog docker-compose up --build -d`)
```
$ docker-compose down
$ docker-compose build
$ docker-compose up -d
$ curl http://localhost:8000/
```It'll be running on [http://localhost:8000/](http://localhost:8000/)
Check that the APM traces are showing in your Datadog org: 
You can then hit the endpoints listed below
## Endpoints
Endpoints are defined in the `main.go` file:
* `/`: this endpoints returns a hello world, and generate a trace with no custom instrumentation.
* `/add-tag`: here, using custom instrumentation, we add a tag to the active span.
* `/set-error`: here we add an error on the current span. The error is made trying to read a file that does not exist.
* `/add-span`: we add a child span to the current one, using context, and then we add a new child with `ChildOf`.
## Tear down
Run `docker-compose down`