Custom Instrumentation

Overview

Custom instrumentation allows for precise monitoring of specific components in your application. It allows you to capture observability data from in-house code or complex functions that aren’t captured by automatic instrumentation. Automatic instrumentation includes Single Step Instrumentation or using Datadog tracing libraries.

Custom instrumentation involves embedding tracing code directly into your application code. This allows for the programmatic creation, modification, or deletion of traces to send to Datadog.

Use cases

Some situations when you might use custom instrumentation include:

  • Collecting observability data from custom code with unique or complex business logic.
  • Providing deeper visibility and context into spans, including adding span tags.
  • Precisely monitoring specific sequences of operations or user interactions that require fine-grained control.
  • Removing unwanted spans from traces.

Getting started

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

Follow the relevant documentation for your custom instrumentation approach to learn more:

Use the Datadog API to add custom instrumentation that allows you to programmatically create, modify, or delete traces to send to Datadog. This is useful for tracing in-house code not captured by automatic instrumentation, removing unwanted spans from traces, and for providing deeper visibility and context into spans, including adding span tags.

Java
Python
Ruby
go
Node.js
PHP
C++
.Net

Datadog tracing libraries provide an implementation of the OpenTelemetry API for instrumenting your code. This means you can maintain vendor-neutral instrumentation of all your services, while still taking advantage of Datadog’s native implementation, features, and products. You can configure it to generate Datadog-style spans and traces to be processed by the Datadog tracing library for your language, and send those to Datadog.

Java
Python
Ruby
go
Node.js
PHP
.Net
iOS
Android

If OpenTelemetry or ddtrace custom instrumentation doesn’t work for you, each of the supported languages also has support for sending OpenTracing data to Datadog. OpenTracing is archived and the project is unsupported.

Java
Python
Node.js

Ruby
go
.Net
PHP

Further reading

PREVIEWING: esther/docs-9518-update-example-control-sensitive-log-data