The Service Map for APM is here!

Tracing Go Applications

Installation and Getting Started

For configuration instructions and details about using the API, check out the Datadog API documentation for manual instrumentation, and the integrations section for Go libraries and frameworks supporting automatic instrumentation.

For a description of the terminology used in APM, take a look at the Getting started with APM section. For details about contributing, check the official repository README.md file.

Consult the migration document if you need to migrate from an older version of the tracer (e.g. v<0.6.x) to newest version.

Installation

First install and configure the Datadog Agent (see additional documentation for tracing Docker applications).

Next, install the Go tracer from its canonical import path:

go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace

You are now ready to import the tracer and start instrumenting your code!

Automatic Instrumentation

We have built a series of pluggable packages which provide out-of-the-box support for instrumenting a series of libraries and frameworks. Find below the list of supported integrations.

Compatibility

To begin tracing your Go applications, your environment must first meet the following requirements:

  • Runing the Datadog Agent >= 5.21.1.
  • Using Go 1.9+

Integrations

Framework Compatibility

Integrate the Go tracer with the following list of web frameworks using one of the following helper packages.

Framework Support Type GoDoc Datadog Documentation
Gin Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/gin-gonic/gin
Gorilla Mux Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux
gRPC Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc
gRPC v1.2 Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc.v12

Library Compatibility

The Go tracer includes support for the following data stores and libraries.

Library Support Type Examples and Documentation
AWS SDK Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws
Elasticsearch Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/olivere/elastic
Cassandra Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/gocql/gocql
GraphQL Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/graph-gophers/graphql-go
HTTP Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http
HTTP router Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/julienschmidt/httprouter
Redis (go-redis) Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis
Redis (redigo) Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/garyburd/redigo
SQL Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql
SQLx Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/jmoiron/sqlx
MongoDB Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/mongodb/mongo-go-driver/mongo
BuntDB Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/tidwall/buntdb
LevelDB Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb
miekg/dns Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/miekg/dns
Kafka (confluent) Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/confluentinc/confluent-kafka-go
Kafka (sarama) Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama
Google API Fully Supported gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/api

Note: The integrations documentation also provides a detailed overview of the supported packages and their APIs, along with usage examples.

Configuration

The tracer is configured with options parameters when the Start function is called. A list of available options are:

package main

import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

func main() {
    // Start the tracer with zero or more options.
    tracer.Start(tracer.WithServiceName("my-service"))
    defer tracer.Stop()
}

For more tracer settings, see available options in the configuration documentation.

Further Reading