dd-trace-go

module
v2.0.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0

README

Main Branch and Release Tests System Tests CodeQL APM Parametric Tests codecov

Godoc

Datadog Client Libraries for Go

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 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 github.com/DataDog/dd-trace-go/v2/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.

Installing

This module contains many packages, but most users should probably install the two packages below:

go get github.com/DataDog/dd-trace-go/v2/ddtrace/tracer
go get github.com/DataDog/dd-trace-go/v2/profiler

Additionally there are many contrib packages, published as nested modules, that can be installed to automatically instrument and trace commonly used Go libraries such as net/http, gorilla/mux or database/sql/v2

go get github.com/DataDog/dd-trace-go/contrib/gorilla/mux/v2

If you installed more packages than you intended, you can use go mod tidy to remove any unused packages.

Documentation

Go Support Policy

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.

Contributing

Before considering contributions to the project, please take a moment to read our brief contribution guidelines.

Testing

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

Directories

Path Synopsis
Package appsec provides application security features in the form of SDK functions that can be manually called to monitor specific code paths and data.
Package appsec provides application security features in the form of SDK functions that can be manually called to monitor specific code paths and data.
events
Package events provides security event types that appsec can return in function calls it monitors when blocking them.
Package events provides security event types that appsec can return in function calls it monitors when blocking them.
All of these libraries are supported by our https://www.datadoghq.com/apm/.
All of these libraries are supported by our https://www.datadoghq.com/apm/.
IBM/sarama Module
IBM/sarama.v1 Module
database/sql Module
gin-gonic/gin Module
go-chi/chi Module
go-chi/chi.v5 Module
go-pg/pg.v10 Module
gocql/gocql Module
gorilla/mux Module
jackc/pgx.v5 Module
jmoiron/sqlx Module
miekg/dns Module
net/http Module
Package ddtrace contains the interfaces that specify the implementations of Datadog's tracing library, as well as a set of sub-packages containing various implementations: our native implementation ("tracer") and a mock tracer to be used for testing ("mocktracer").
Package ddtrace contains the interfaces that specify the implementations of Datadog's tracing library, as well as a set of sub-packages containing various implementations: our native implementation ("tracer") and a mock tracer to be used for testing ("mocktracer").
ext
Package ext contains a set of Datadog-specific constants.
Package ext contains a set of Datadog-specific constants.
mocktracer
Package mocktracer provides a mock implementation of the tracer used in testing.
Package mocktracer provides a mock implementation of the tracer used in testing.
opentelemetry
Package opentelemetry provides a wrapper on top of the Datadog tracer that can be used with OpenTelemetry.
Package opentelemetry provides a wrapper on top of the Datadog tracer that can be used with OpenTelemetry.
tracer
Package tracer contains Datadog's core tracing client.
Package tracer contains Datadog's core tracing client.
appsec/dyngo
Package dyngo is the Go implementation of Datadog's Instrumentation Gateway which provides an event-based instrumentation API based on a stack representation of instrumented functions along with nested event listeners.
Package dyngo is the Go implementation of Datadog's Instrumentation Gateway which provides an event-based instrumentation API based on a stack representation of instrumented functions along with nested event listeners.
appsec/emitter
Package emitter provides functions and types used to instrument go libraries to integrate them with Datadog AppSec features.
Package emitter provides functions and types used to instrument go libraries to integrate them with Datadog AppSec features.
appsec/emitter/graphqlsec
Package graphqlsec is the GraphQL instrumentation API and contract for AppSec defining an abstract run-time representation of AppSec middleware.
Package graphqlsec is the GraphQL instrumentation API and contract for AppSec defining an abstract run-time representation of AppSec middleware.
appsec/emitter/grpcsec
Package grpcsec is the gRPC instrumentation API and contract for AppSec defining an abstract run-time representation of gRPC handlers.
Package grpcsec is the gRPC instrumentation API and contract for AppSec defining an abstract run-time representation of gRPC handlers.
appsec/emitter/httpsec
Package httpsec defines is the HTTP instrumentation API and contract for AppSec.
Package httpsec defines is the HTTP instrumentation API and contract for AppSec.
httpmem
Package httpmem provides an in-memory HTTP server and client, for testing
Package httpmem provides an in-memory HTTP server and client, for testing
httptrace
Package httptrace provides functionalities to trace HTTP requests that are commonly required and used across contrib/** integrations.
Package httptrace provides functionalities to trace HTTP requests that are commonly required and used across contrib/** integrations.
globalconfig
Package globalconfig stores configuration which applies globally to both the tracer and integrations.
Package globalconfig stores configuration which applies globally to both the tracer and integrations.
hostname/cachedfetch
Package cachedfetch provides a read-through cache for fetched values.
Package cachedfetch provides a read-through cache for fetched values.
hostname/validate
Package validate provides hostname validation helpers
Package validate provides hostname validation helpers
log
Package log provides logging utilities for the tracer.
Package log provides logging utilities for the tracer.
namingschema
Package namingschema allows to use the naming schema from the integrations to set different service and span/operation names based on the value of the DD_TRACE_SPAN_ATTRIBUTE_SCHEMA environment variable.
Package namingschema allows to use the naming schema from the integrations to set different service and span/operation names based on the value of the DD_TRACE_SPAN_ATTRIBUTE_SCHEMA environment variable.
normalizer
Package normalizer provides tag normalization
Package normalizer provides tag normalization
telemetry
Package telemetry implements a client for sending telemetry information to Datadog regarding usage of an APM library such as tracing or profiling.
Package telemetry implements a client for sending telemetry information to Datadog regarding usage of an APM library such as tracing or profiling.
telemetry/telemetrytest
Package telemetrytest provides a mock implementation of the telemetry client for testing purposes
Package telemetrytest provides a mock implementation of the telemetry client for testing purposes
traceprof
Package traceprof contains shared logic for cross-cutting tracer/profiler features.
Package traceprof contains shared logic for cross-cutting tracer/profiler features.
traceprof/testapp
Package testapp has the protbuf/grpc definitions for the test application implemented in traceproftest.
Package testapp has the protbuf/grpc definitions for the test application implemented in traceproftest.
Package profiler periodically collects and sends profiles to the Datadog API.
Package profiler periodically collects and sends profiles to the Datadog API.
internal/fastdelta
Package fastdelta tries to match up samples between two pprof profiles and take their difference.
Package fastdelta tries to match up samples between two pprof profiles and take their difference.
internal/immutable
Package immutable provides read-only types
Package immutable provides read-only types
internal/pproflite
Package pproflite implements zero-allocation pprof encoding and decoding.
Package pproflite implements zero-allocation pprof encoding and decoding.
internal/pprofutils
Package pprofutils is a fork of github.com/felixge/pprofutils, see README.
Package pprofutils is a fork of github.com/felixge/pprofutils, see README.
v1internal
telemetry
Package telemetry implements a client for sending telemetry information to Datadog regarding usage of an APM library such as tracing or profiling.
Package telemetry implements a client for sending telemetry information to Datadog regarding usage of an APM library such as tracing or profiling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL