이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Compatibility requirements

The Go Tracer requires Go 1.18+ and Datadog Agent >= 5.21.1. For a full list of Datadog’s Go version and framework support (including legacy and maintenance versions), see the Compatibility Requirements page.

Getting started

Before you begin, make sure you’ve already installed and configured the Agent.

There are two ways to instrument your Go application:

  1. Manual instrumentation:
    • Gives you complete control over which parts of your application are traced.
    • Requires modifying the application’s source code.
  2. Compile-time instrumentation:
    • Ensures maximum coverage of your tracing instrumentation.
    • Does not require source code modifications, making ideal for integrating at the CI/CD level.

Refer to the instructions in the section corresponding to your preference below:

Activate Go integrations to create spans

Datadog has a series of pluggable packages which provide out-of-the-box support for instrumenting a series of libraries and frameworks. A list of these packages can be found in the Compatibility Requirements page. Import these packages into your application and follow the configuration instructions listed alongside each Integration.

Configuration

If needed, configure the tracing library to send application performance telemetry data as you require, including setting up Unified Service Tagging. Read Library Configuration for details.

For configuration instructions and details about using the API, see the Datadog API documentation.

Overview

Orchestrion automatically adds instrumentation to Go applications during compilation, eliminating the need for code changes. It provides comprehensive tracing coverage and enables exclusive security features:

  • Comprehensive tracing coverage:
    • Instruments your code and all dependencies, including the Go standard library
    • Instruments your code during compilation, preventing gaps in tracing coverage due to overlooked manual instrumentation
  • Exclusive Application Security Management Exploit Prevention feature. Exploit Prevention is a Runtime Application Self-Protection (RASP) implementation and includes RASP methods such as Local File Inclusion (LFI).

Requirements

Supported packages

Orchestrion is under active development and supports a subset of integrations available in the tracing library. For the latest list of supported frameworks and their minimum Orchestrion versions, see the Supported frameworks.

Install Orchestrion

To install and set up Orchestrion:

  1. Install Orchestrion:

    go install github.com/DataDog/orchestrion@latest
    
    Ensure $(go env GOBIN) (or $(go env GOPATH)/bin) is in your $PATH.
  2. Register Orchestrion in your project’s go.mod:

    orchestrion pin
    
  3. Commit changes to your version control system:

    git commit -m "chore: enable orchestrion" go.mod go.sum orchestrion.tool.go
    

Now you can manage your dependency on orchestrion like any other dependency using the go.mod file.

Usage

Use one of these methods to enable Orchestrion in your build process:

Prepend orchestrion to your usual go commands:

orchestrion go build .
orchestrion go run .
orchestrion go test ./...

Add the -toolexec="orchestrion toolexec" argument to your go commands:

go build -toolexec="orchestrion toolexec" .
go run -toolexec="orchestrion toolexec" .
go test -toolexec="orchestrion toolexec" ./...

Modify the $GOFLAGS environment variable to inject Orchestrion, and use go commands normally:

# Make sure to include the quotes as shown below, as these are required for
# the Go toolchain to parse GOFLAGS properly!
export GOFLAGS="${GOFLAGS} '-toolexec=orchestrion toolexec'"
go build .
go run .
go test ./...

Create custom trace spans

To create custom trace spans for functions accepting context.Context or *http.Request arguments, add the //dd:span directive comment to the function declaration:

example.go

//dd:span custom_tag:tag_value
func CriticalPathFunction(ctx context.Context) {
  // ... implementation details ...
}

This also works with function literal expressions:

example.go

//dd:span custom_tag:tag_value
handler := func(w http.ResponseWriter, r *http.Request) {
  // ... implementation details ...
}

Use the tracing library

You can use the tracing library in your Orchestrion-built application. This is useful for instrumenting frameworks not yet supported by Orchestrion. However, be aware that this may result in duplicated trace spans in the future as Orchestrion support expands. Review the release notes when updating your orchestrion dependency to stay informed about new features and adjust your manual instrumentation as necessary.

Use the continuous profiler

Your Orchestrion-built application includes continuous profiler instrumentation. To enable the profiler, set the environment variable DD_PROFILING_ENABLED=true at run time.

Supported frameworks

LibraryMinimum orchestrion version
database/sqlv0.7.0
github.com/gin-gonic/ginv0.7.0
github.com/go-chi/chi/v5v0.7.0
github.com/go-chi/chiv0.7.0
github.com/go-redis/redis/v7v0.7.0
github.com/go-redis/redis/v8v0.7.0
github.com/gofiber/fiber/v2v0.7.0
github.com/gomodule/redigo/redisv0.7.0
github.com/gorilla/muxv0.7.0
github.com/jinzhu/gormv0.7.0
github.com/labstack/echo/v4v0.7.0
google.golang.org/grpcv0.7.0
gorm.io/gormv0.7.0
net/httpv0.7.0
go.mongodb.org/mongo-driver/mongov0.7.3
k8s.io/client-gov0.7.4
github.com/hashicorp/vaultv0.7.4

Further reading

PREVIEWING: rtrieu/product-analytics-ui-changes