---
title: Application Instrumentation
description: Get Started with Datadog APM
breadcrumbs: Docs > APM > Application Instrumentation
---

# Application Instrumentation

## Overview{% #overview %}

Application instrumentation (Instrumentation is the process of adding code to your application to capture and report observability data to Datadog, such as traces, metrics, and logs.) with Datadog APM involves:

1. **SDK setup**: Adding a Datadog SDK to your application.

1. **Span creation**: Capturing observability data as span (A span is a logical unit of work in a distributed system for a given period.)s.

Spans are automatically generated by default as soon as the SDK is loaded. This is known as **auto-instrumentation** and provides sufficient visibility for most users. If you need more control, you can optionally add custom spans.

**Note**: These steps assume you have a [Datadog Agent](https://docs.datadoghq.com/agent.md) installed and configured to receive traces.

{% image
   source="https://docs.dd-static.net/images/tracing/visualization/troubleshooting_pipeline.68ceea859e08a050cfd9a3ff155a5bd7.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/tracing/visualization/troubleshooting_pipeline.68ceea859e08a050cfd9a3ff155a5bd7.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The APM pipeline" /%}

## Getting started{% #getting-started %}

{% alert level="info" %}
**Prefer vendor-neutral instrumentation?** See the [OpenTelemetry documentation](https://docs.datadoghq.com/opentelemetry.md) for using OpenTelemetry with Datadog.
{% /alert %}

### Single step instrumentation (recommended){% #single-step-instrumentation-recommended %}

[Single Step Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/single-step-apm.md) (SSI) automatically installs and configures Datadog SDKs with a single command. Auto-instrumentation then immediately begins capturing traces from your supported frameworks and libraries, with no code changes required.

- [Get started with Single Step Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/single-step-apm.md)

### Manual setup and custom spans{% #manual-setup-and-custom-spans %}

As your observability needs grow, you can add more control and customization:

**For full SDK configuration control:** Use [manually managed Datadog SDKs](https://docs.datadoghq.com/tracing/trace_collection/dd_libraries.md) if you need granular control over SDK behavior and configuration.

- [Use manually managed Datadog SDKs](https://docs.datadoghq.com/tracing/trace_collection/dd_libraries.md)

**For custom spans without code changes:** Use [Dynamic Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/dynamic_instrumentation.md) to create custom spans from the Datadog UI without redeploying your application.

- [Add custom spans with Dynamic Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/dynamic_instrumentation.md)

**For custom spans in code:** Add [code-based custom instrumentation](https://docs.datadoghq.com/tracing/trace_collection/custom_instrumentation.md) to instrument custom business logic or add application-specific metadata to spans.

- [Add custom spans with code-based instrumentation](https://docs.datadoghq.com/tracing/trace_collection/custom_instrumentation.md)

These options can be combined. For example, you can start with Single Step Instrumentation and add code-based custom instrumentation for specific spans, or use manually managed SDKs with Dynamic Instrumentation for no-deploy span additions.

## Detailed comparison{% #detailed-comparison %}

### SDK setup{% #sdk-setup %}

Single Step Instrumentation is the recommended starting point for most users. If you need more control over SDK configuration, you can use manually managed SDKs instead:

| [Single Step Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/single-step-apm.md) (recommended) | [Manually managed SDKs](https://docs.datadoghq.com/tracing/trace_collection/dd_libraries.md)                      |
| ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| How it works                                                                                                        | Datadog automatically installs and loads SDKs into your application processes, at runtime, with a single command. | You install and configure SDKs directly in your application code or build process.   |
| Code changes?                                                                                                       | No                                                                                                                | Yes                                                                                  |
| Setup complexity                                                                                                    | Low - minimal configuration needed                                                                                | Medium - requires environment and build configuration                                |
| Configuration control                                                                                               | Standard defaults with optional overrides                                                                         | Full control through environment variables and code                                  |
| When to use                                                                                                         | Start here for fast, consistent instrumentation across services without code changes.                             | Progress to this when you need granular control over SDK behavior and configuration. |

### Span customization{% #span-customization %}

Auto-instrumentation automatically creates spans for supported frameworks and libraries, providing essential observability with no additional work. When you need visibility into custom code paths or want to enrich traces with application-specific data, you can add custom spans using either Dynamic Instrumentation or code-based custom instrumentation:

| [Dynamic Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/dynamic_instrumentation.md) | [Code-based custom instrumentation](https://docs.datadoghq.com/tracing/trace_collection/custom_instrumentation.md) |
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| How it works                                                                                              | Configure instrumentation rules in the Datadog UI; rules are applied at runtime.                                   | Add explicit tracing API calls in your application code.                                                |
| Code changes?                                                                                             | No                                                                                                                 | Yes                                                                                                     |
| Deployment required                                                                                       | No                                                                                                                 | Yes (to add or modify spans)                                                                            |
| When to use                                                                                               | Add custom spans without code changes or redeployments.                                                            | Progress to this when you need complex instrumentation logic or want spans permanently defined in code. |

## APM setup tutorials{% #apm-setup-tutorials %}

The following tutorials guide you through setting up distributed tracing for a sample application on various infrastructure scenarios, with both automatic and custom instrumentation:

- [Enabling Tracing on a Python Application on the Same Host as Datadog Agent](https://docs.datadoghq.com/tracing/guide/tutorial-enable-python-host.md)
- [Enabling Tracing on a Python Application and Datadog Agent in Containers](https://docs.datadoghq.com/tracing/guide/tutorial-enable-python-containers.md)
- [Enabling Tracing for a Python Application in a Container and an Agent on a Host](https://docs.datadoghq.com/tracing/guide/tutorial-enable-python-container-agent-host.md)
- [Enabling Tracing on a Java Application on the Same Host as Datadog Agent](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-host.md)
- [Enabling Tracing on a Java Application and Datadog Agent in Containers](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-containers.md)
- [Enabling Tracing for a Java Application in a Container and an Agent on a Host](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-container-agent-host.md)
- [Enabling Tracing for a Java Application on GKE](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-gke.md)
- [Enabling Tracing for a Java Application on Amazon EKS](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-aws-eks.md)
- [Enabling Tracing for a Java Application in Amazon ECS with EC2](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-aws-ecs-ec2.md)
- [Enabling Tracing for a Java Application in Amazon ECS with Fargate](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-aws-ecs-fargate.md)
- [Enabling Tracing for a Java Application with the Admission Controller](https://docs.datadoghq.com/tracing/guide/tutorial-enable-java-admission-controller.md)
- [Enabling Tracing on a Go Application on the Same Host as Datadog Agent](https://docs.datadoghq.com/tracing/guide/tutorial-enable-go-host.md)
- [Enabling Tracing on a Go Application and Datadog Agent in Containers](https://docs.datadoghq.com/tracing/guide/tutorial-enable-go-containers.md)
- [Enabling Tracing for a Go Application in Amazon ECS with EC2](https://docs.datadoghq.com/tracing/guide/tutorial-enable-go-aws-ecs-ec2.md)
- [Enabling Tracing for a Go Application in Amazon ECS with Fargate](https://docs.datadoghq.com/tracing/guide/tutorial-enable-go-aws-ecs-fargate.md)

## Further reading{% #further-reading %}

- [Compatibility requirements](https://docs.datadoghq.com/tracing/trace_collection/compatibility.md)
- [APM Terms and Concepts](https://docs.datadoghq.com/tracing/glossary.md)
- [Enable end-to-end visibility into your Java apps with a single command](https://www.datadoghq.com/blog/rum-apm-single-step)
- [Instrument your app using the Datadog Operator and Admission Controller](https://www.datadoghq.com/architecture/instrument-your-app-using-the-datadog-operator-and-admission-controller/)
