Configure Application
Middleware Application Performance Monitoring (APM) collects distributed traces, spans, service and endpoint data, and application performance metrics from instrumented applications.
Use this telemetry data to follow requests across services, identify slow operations, and investigate errors. This guide explains the available instrumentation approaches and when to use each one.
Middleware supports two ways to instrument your application:
- Auto-instrumentation: Instrument supported applications with no application code changes.
- SDK instrumentation: Add the Middleware APM SDK to your application for more control over instrumentation and custom spans.
You can use either method independently or combine them based on your instrumentation requirements.
Getting started#
Auto instrumentation (recommended)#
Auto-instrumentation is the recommended way to get started when your application and framework are supported.
First, install the Middleware Infrastructure Agent on your host. Middleware detects supported applications running on the infrastructure and makes them available for instrumentation.
To instrument an application:
- Install and configure the Middleware Infrastructure Agent.
- Select a detected application that you want to instrument.
- Enable instrumentation for the application.
- Restart the application if prompted.
Middleware automatically configures instrumentation for supported frameworks and libraries and begins collecting traces and spans without requiring changes to your application code.
SDK instrumentation (manual)#
SDK instrumentation is useful when you need custom spans or attributes that describe business operations beyond the framework and library calls collected automatically.
Install the Middleware APM SDK for your application's language or framework and configure it within your application.
SDK instrumentation can be used to:
- Collect traces and spans from your application.
- Create custom spans for application-specific operations.
- Add custom attributes to spans.
- Control instrumentation and SDK configuration at the application level.
Refer to the SDK documentation for your language to configure instrumentation.
Combine Auto and Manual Instrumentation#
Auto-instrumentation and manual instrumentation can be used together.
For example, automatic instrumentation can capture the HTTP and database calls in a checkout request, while a custom span describes an application-specific operation such as calculating a discount. The custom span adds context about the business operation within the request.
This approach adds detail where automatic instrumentation does not describe the operation clearly, while keeping the existing framework and library coverage.
Comparison
| Auto instrumentation | SDK | |
|---|---|---|
| How it works | Middleware instruments supported applications automatically at runtime. | You install the SDK directly in your application code. |
| Code changes? | No | Yes |
| Setup complexity | No complexity | Medium, requires env and build configuration |
| Use when | You want to start fast without code changes. | You need custom spans, attributes, or more control over instrumentation. |
You can start with auto-instrumentation and add SDK-based custom instrumentation later if you need additional application-level visibility.
What did you think of this content?