Built-in Configuration

Built-in Configuration

Orchestrion includes built-in configuration that automatically instruments many libraries using the Datadog tracing library, .

These automated instrumentations are modeled as aspects, which are the combination of:

  • a join point, which is a standardized description of the location where instrumentation code is to be added,
  • one or more advice, which describe the modifications to be made.

The following pages highlights what libraries are supported, how instrumentation is achieved, and any caveats or limitations to be aware of:

//dd:orchestrion-enabled

Flip a boolean to true if Orchestrion is enabled.

//dd:span

Create a span surrounding all calls to the annotated function by adding a //dd:span directive on the function declaration. The default operation (span) name is the name of the function, but this can be overridden by specifying a span.name argument:

//dd:span span.name:custom-operation-name other:tag
func myFunction() {
  // The default operation name would have been "myFunction"
}

Function literal expressions don’t have a function name, and their default operation name is the value of the very first directive argument (if there is one). If there are no directive arguments, the operation name will remain blank.

//dd:span other:tag span.name:custom-operation-name
myOp := func() {
  // The default operation name would have been "tag"
}
cloud.google.com/go/pubsub

Package pubsub provides an easy way to publish and receive Google Cloud Pub/Sub messages, hiding the details of the underlying server RPCs

database/sql

A generic interface around SQL (or SQL-like) databases.

func main()

The entry point of a Go program.

github.com/99designs/gqlgen

gqlgen is a Go library for building GraphQL servers without any fuss.

github.com/aws/aws-sdk-go

The official AWS SDK for Go

github.com/aws/aws-sdk-go-v2

AWS SDK for the Go programming language.

github.com/confluentinc/confluent-kafka-go/kafka

confluent-kafka-go is a Go library for Apache Kafka

github.com/elastic/go-elasticsearch

The official Go client for Elasticsearch

github.com/gin-gonic/gin

Gin is a web framework written in Go.

github.com/go-chi/chi

chi is a lightweight, idiomatic and composable router for building Go HTTP services.

github.com/go-redis/redis

Redis client for Go.

github.com/gocql/gocql

Package gocql implements a fast and robust Cassandra client for the Go programming language.

github.com/gofiber/fiber

An Express inspired web framework built on Fasthttp, the fastest HTTP engine for Go.

github.com/gomodule/redigo/redis

Redigo is a Go client for the Redis database.

github.com/gorilla/mux

Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler.

github.com/graph-gophers/graphql-go github.com/graphql-go/graphql github.com/hashicorp/vault/api

Official package for interacting with a Vault server.

github.com/IBM/sarama

Sarama is a Go library for Apache Kafka

github.com/jackc/pgx

PostgreSQL driver and toolkit for Go.

github.com/julienschmidt/httprouter

A high performance HTTP request router that scales well.

github.com/labstack/echo

High performance, extensible, minimalist Go web framework.

github.com/segmentio/kafka-go

Kafka library in Go

github.com/Shopify/sarama

Sarama is a Go library for Apache Kafka

github.com/twitchtv/twirp

A simple RPC framework with protobuf service definitions.

Details & Caveats

  • This instrumentation currently uses the wrappers from the dd-trace-go contrib/net/http package, not the ones from contrib/twitchtv/twirp.
  • The server-side instrumentation additionally adds rpc / twirp specific spans using *twirp.ServerHooks.
  • Currently, the *twirp.ClientHooks implementation is not available in dd-trace-go, so the only generated spans are the ones from net/http.
go.mongodb.org/mongo-driver/mongo

Official Golang driver for MongoDB.

google.golang.org/grpc

The Go implementation of gRPC.

gorm.io/gorm and github.com/jinzhu/gorm

The fantastic ORM library for Golang.

k8s.io/client-go

Go client for Kubernetes.

log/slog

Package slog provides structured logging, in which log records include a message, a severity level, and various other attributes expressed as key-value pairs.

net/http.Client

HTTP client implementation.

net/http.Server

HTTP server implementation.

os

Protection from Local File Inclusion (LFI) Attacks

All known functions that open files are susceptible to Local File Inclusion (LFI) attacks. This aspect protects against LFI attacks by wrapping the os.OpenFile function with a security operation that will block the operation if it is deemed unsafe.

Instrumenting only the os.OpenFile function is sufficient to protect against LFI attacks, as all other functions in the os package that open files ultimately call os.OpenFile (as of Go 1.23).

runtime

Operations that interact with Go’s runtime system.

testing

Testing instrumentation

Last updated on