This repository contains Go packages for the client-side components of the Datadog product suite for Application Performance Monitoring, Continuous Profiling and Application Security Monitoring of Go applications.
-
Datadog Application Performance Monitoring (APM): Trace requests as they flow across web servers, databases and microservices so that developers have great visibility into bottlenecks and troublesome requests. The package
gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer
allows you to trace any piece of your Go code, and commonly used Go libraries can be automatically traced thanks to our out-of-the-box integrations which can be found in the packagegopkg.in/DataDog/dd-trace-go.v1/ddtrace/contrib
. -
Datadog Go Continuous Profiler: Continuously profile your Go apps to find CPU, memory, and synchronization bottlenecks, broken down by function name, and line number, to significantly reduce end-user latency and infrastructure costs. The package
gopkg.in/DataDog/dd-trace-go.v1/profiler
allows you to periodically collect and send Go profiles to the Datadog API. -
Datadog Application Security Management (ASM) provides in-app monitoring and protection against application-level attacks that aim to exploit code-level vulnerabilities, such as a Server-Side-Request-Forgery (SSRF), a SQL injection (SQLi), or Reflected Cross-Site-Scripting (XSS). ASM identifies services exposed to application attacks and leverages in-app security rules to detect and protect against threats in your application environment. ASM is not a standalone Go package and is transparently integrated into the APM tracer. You can simply enable it with
DD_APPSEC_ENABLED=true
.
This module contains many packages, but most users should probably install the two packages below:
go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer
go get gopkg.in/DataDog/dd-trace-go.v1/profiler
Additionally there are many contrib packages that can be installed to automatically instrument and trace commonly used Go libraries such as net/http, gorilla/mux or database/sql:
go get gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux
If you installed more packages than you intended, you can use go mod tidy
to remove any unused packages.
- APM Tracing API
- APM Tracing Go Applications
- Continuous Go Profiler
- Application Security Monitoring
- If you are migrating from an older version of the tracer (e.g. 0.6.x) you may also find the migration document we've put together helpful.
Datadog APM for Go is built upon dependencies defined in specific versions of the host operating system, Go releases, and the Datadog Agent/API. dd-trace-go supports the two latest releases of Go, matching the official Go policy. This library only officially supports first class ports of Go.
Before considering contributions to the project, please take a moment to read our brief contribution guidelines.
Tests can be run locally using the Go toolset.
To run integration tests locally, you should set the INTEGRATION
environment variable. The dependencies of the integration tests are best run via Docker. To get an
idea about the versions and the set-up take a look at our docker-compose config.
The best way to run the entire test suite is using the test.sh script. You'll need Docker and docker-compose installed. If this is your first time running the tests, you should run ./test.sh -t
to install any missing test tools/dependencies. Run ./test.sh --all
to run all of the integration tests through the docker-compose environment. Run ./test.sh --help
for more options.
If you're only interested in the tests for a specific integration it can be useful to spin up just the required containers via docker-compose.
For example if you're running tests that need the mysql
database container to be up:
docker compose -f docker-compose.yaml -p dd-trace-go up -d mysql