SDKs overview
Datadog provides a suite of Software Development Kits (SDKs) and client libraries designed to facilitate integration with its observability platform. These SDKs enable developers to programmatically interact with the Datadog API, send telemetry data (metrics, logs, traces), and manage various Datadog resources directly from their applications and infrastructure. The primary goal of these libraries is to simplify the process of instrumenting code, collecting operational data, and ensuring that applications report necessary information for monitoring and analysis within the Datadog ecosystem.
The SDKs abstract the underlying HTTP requests and data formatting requirements, offering idiomatic interfaces for each supported programming language. This allows developers to focus on what data to send rather than how to format and transmit it. Key functionalities supported by the SDKs include:
- Metrics Submission: Sending custom metrics from applications to track performance indicators, business-specific data, and operational health.
- Log Collection: Forwarding application logs to Datadog for centralized management, search, and analysis.
- Trace Generation: Instrumenting code to generate distributed traces for Application Performance Monitoring (APM), enabling end-to-end visibility into request flows.
- Event Posting: Submitting custom events to mark deployments, outages, or other significant occurrences on Datadog dashboards and event streams.
- API Interaction: Managing Datadog resources such as dashboards, monitors, users, and service definitions programmatically.
The availability of official SDKs for major programming languages—including Python, Java, Go, and Node.js—ensures broad compatibility across development environments. Additionally, a community of developers contributes to and maintains libraries for other languages and specialized use cases, further extending Datadog's integration capabilities. The Datadog documentation portal provides detailed guides and API references for each SDK.
Official SDKs by language
Datadog maintains official SDKs for several programming languages, providing stable and supported interfaces for integration. These libraries are designed to align with the best practices of each language ecosystem and are regularly updated to support new Datadog features and API versions. The table below outlines the key official SDKs, their package names, and typical installation commands.
| Language | Package Name | Installation Command | Maturity / Status |
|---|---|---|---|
| Python | datadog |
pip install datadog |
Stable, Actively Maintained |
| Ruby | datadog |
gem install datadog |
Stable, Actively Maintained |
| Go | github.com/DataDog/datadog-api-client-go |
go get github.com/DataDog/datadog-api-client-go |
Stable, Actively Maintained |
| Java | com.datadoghq:datadog-api-client |
Maven: Add dependency; Gradle: Add dependency | Stable, Actively Maintained |
| Node.js | @datadog/datadog-api-client |
npm install @datadog/datadog-api-client |
Stable, Actively Maintained |
| PHP | datadog/datadog-api-client |
composer require datadog/datadog-api-client |
Stable, Actively Maintained |
| C# | Datadog.Api.Client |
dotnet add package Datadog.Api.Client |
Stable, Actively Maintained |
| Swift | Datadog |
Swift Package Manager: Add dependency | Stable, Actively Maintained |
| Rust | datadog-api |
cargo add datadog-api |
Stable, Actively Maintained |
Each official SDK provides specific modules or classes for interacting with different aspects of the Datadog API, such as metrics, events, and service checks. Developers are encouraged to consult the specific SDK documentation for detailed usage examples and API endpoint mappings.
Installation
Installation of Datadog SDKs typically follows the standard package management practices for each programming language. The general process involves adding the Datadog client library as a dependency to your project. Below are examples for selected popular languages:
Python
The Python SDK is installed via pip, the Python package installer. After installation, you can initialize the API client with your Datadog API and application keys.
pip install datadog
Go
For Go projects, the module can be fetched using go get. You then import the client library and configure it with your API and application keys.
go get github.com/DataDog/datadog-api-client-go
Node.js
The Node.js SDK is available through npm, the Node.js package manager. Installation is performed using the npm install command.
npm install @datadog/datadog-api-client
Java
For Java, you typically add the SDK as a dependency in your build tool configuration, such as Maven or Gradle.
Maven example:
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>datadog-api-client</artifactId>
<version>X.Y.Z</version> <!-- Replace with the latest version -->
</dependency>
Gradle example:
implementation 'com.datadoghq:datadog-api-client:X.Y.Z' // Replace with the latest version
For all languages, it is essential to obtain your Datadog API Key and Application Key from your Datadog account settings. These keys are used to authenticate your requests against the Datadog API.
Quickstart example
This example demonstrates sending a custom metric and an event to Datadog using the Python SDK. This quickstart illustrates fundamental interactions for collecting telemetry data.
from datadog import initialize, statsd
# Configure Datadog API and Application keys
# It's recommended to use environment variables for keys in production
options = {
'api_key': '<YOUR_DATADOG_API_KEY>',
'app_key': '<YOUR_DATADOG_APP_KEY>'
}
initialize(**options)
# Send a custom metric
# 'my.app.requests.total' is the metric name
# 1 is the value
# tags provide context (e.g., environment, service)
statsd.increment('my.app.requests.total', 1, tags=['env:production', 'service:web-app'])
print("Sent custom metric 'my.app.requests.total'")
# Send an event
# Events mark significant occurrences
from datadog import api
api.Event.create(title="Web App Deployment Complete",
text="New version deployed successfully to production.",
tags=['deployment', 'env:production', 'service:web-app'],
alert_type='success')
print("Sent event 'Web App Deployment Complete'")
# Note: Metrics sent via statsd are typically UDP and non-blocking.
# Events are sent via HTTP and are blocking.
Before running this code, replace <YOUR_DATADOG_API_KEY> and <YOUR_DATADOG_APP_KEY> with your actual Datadog credentials. For production environments, these keys should be managed securely, often through environment variables or a secrets management service.
Community libraries
In addition to the official SDKs, the Datadog ecosystem benefits from community-contributed libraries and integrations. These libraries often extend Datadog's capabilities to niche frameworks, specialized data sources, or programming languages not officially supported. While not directly maintained by Datadog, community projects can offer flexible solutions for specific integration challenges.
Examples of community contributions often include:
- Framework-specific integrations: Libraries that integrate Datadog APM or logging with frameworks like Ruby on Rails, Django, or Spring Boot, sometimes offering deeper automation than generic SDKs.
- Specialized data collectors: Custom agents or scripts designed to extract metrics or logs from less common enterprise applications or legacy systems and forward them to Datadog.
- Language clients: SDKs for languages where an official client might not yet exist or is less mature, developed and maintained by the broader developer community.
- Tooling and utilities: Scripts or applications that automate common Datadog tasks, such as dashboard generation, monitor setup, or alert management, beyond what the official API clients might directly expose as high-level functions.
When considering a community library, developers should evaluate its maintenance status, community support, and compatibility with the latest Datadog API versions. While community-driven, these projects can provide valuable patterns for extending observability. Developers can often discover these resources through public code repositories like GitHub or through community forums. For instance, the open-source community frequently publishes such extensions.
It's advisable to check the Datadog Integrations page and relevant community forums for up-to-date information on available community-maintained tools and libraries.