OpenTelemetry for Spring Boot: Java agent or starter

The Java agent and the Spring Boot starter both send Spring Boot telemetry through OpenTelemetry. This page explains when each fits, what each trades away, and how to plan the rollout.

On this page

OpenTelemetry for Spring Boot: which option fits your services

For most Spring Boot teams, the Java agent is the default choice. The OpenTelemetry documentation names it the default for Spring Boot because it ships with more out-of-the-box instrumentation. The Spring Boot starter is the better fit in four situations: you build Spring Boot native images, agent startup overhead is too high for your services, you already run another Java monitoring agent, or you want to configure telemetry through application.properties or application.yml instead of JVM arguments and environment variables. If none of those apply, start with the agent and move to the starter only when one of them becomes a real constraint.

OpenTelemetry is vendor-neutral, and it is not an observability backend. It generates and exports traces, metrics and logs, but it does not store or visualize them. Whichever option you choose, you still need to plan where the data goes, usually through an OpenTelemetry Collector that receives, processes and exports telemetry to a backend you select. Decide the Collector topology and backend early, because the choice between agent and starter changes how the export endpoint, service name and resource attributes are set on each service. Confirm the current Collector release and its component stability with the OpenTelemetry Collector releases page before you pin versions in your build.

Both options also affect who owns the configuration. With the agent, settings usually come from JVM flags or environment variables that your platform team can set across many services without touching code. With the starter, settings live in the application's own property files and build dependencies, which gives developers direct control but means each team maintains its telemetry setup alongside the application. Ask your engineering leads which model matches how your services are deployed, and verify the starter's configuration keys against the current Spring Boot starter documentation before you standardize on them.

Java agent or Spring Boot starter: when each option fits

This table compares the Java agent and the Spring Boot starter on the factors that usually decide the choice: native images, startup overhead, instrumentation coverage, coexistence with another Java monitoring agent, and configuration style. Read each row as the documented fit for that case, then check it against your own runtime, build pipeline and existing monitoring stack before deciding.

Decision factorJava agentSpring Boot starter
Default choice in the docsThe default for Spring Boot because it has more out-of-the-box instrumentationRecommended for specific cases rather than as the general default
Spring Boot native imagesNot the fit the docs recommend for native image buildsRecommended for Spring Boot native images
Startup overheadConsider the starter if agent startup overhead is too high for your serviceRecommended when agent startup overhead is too high
Out-of-the-box instrumentationBroadest coverage of libraries without code changesConfirm which libraries your services use are covered before relying on it
Another Java monitoring agent in placeConfirm the two agents can coexist in your JVM before rolloutRecommended when another Java monitoring agent is already used
Configuration through application propertiesConfigured through agent settings such as system properties or environment variablesConfigured through application.properties or application.yml, matching how Spring teams already manage settings
Verification in your environmentTest startup time, memory use and throughput under production-like loadTest the native image build and the instrumentation coverage your services need

Which factors decide the choice for a Spring Boot service

Five factors usually settle whether a Spring Boot service gets the Java agent or the starter. Each one maps to a documented recommendation, and each one has a check that should happen before the team commits to a path.

Native image builds

The OpenTelemetry docs recommend the Spring Boot starter for Spring Boot native images, because the Java agent attaches to a running JVM and native images do not run that way. If a service is compiled ahead of time with GraalVM, confirm the build pipeline and the starter version you plan to use together in a test build before you standardize on either path. Check the native build's reflection and resource configuration as part of that test.

Starter docs

Startup time budget

The docs recommend the starter when agent startup overhead is too high for the service. Measure cold start for the agent-attached build against the target, using the same container image, heap settings and dependency set your production runs. Confirm the budget with the service owner, since slow startup matters most for services that scale out quickly or restart often.

Existing Java monitoring agent

When another Java monitoring agent is already attached to the JVM, the docs recommend the starter. Two agents instrumenting the same libraries can duplicate spans, conflict on bytecode changes and add overhead. List the agents already in the JVM arguments and in the base image, then decide with the platform team which one owns each library before anything is deployed.

Instrumentation coverage beyond Spring Boot

The docs name the Java agent as the default because it has more out-of-the-box instrumentation. If the service calls databases, message brokers, HTTP clients or libraries outside Spring, compare the library list for each option against the calls the service makes. Gaps found in the starter usually need manual spans or the agent, so this check decides whether the starter alone covers the service's traces.

Configuration in application properties

The docs recommend the starter when configuration should live in application.properties or application.yml. Teams that keep settings in Spring configuration, Spring Cloud Config or a secrets store should check how the exporter endpoint, service name and sampling values will be injected per environment. The agent is configured through JVM properties and environment variables, so the team should decide which configuration model its deployment tooling supports.

How the Java agent and the starter collect telemetry

The two options differ in where instrumentation happens. The Java agent is a javaagent attached to the JVM at startup, usually with a -javaagent flag on the command line or in the container entrypoint. It rewrites bytecode of supported libraries as classes load, so HTTP servers, database drivers, messaging clients and HTTP clients emit spans without any change to application code. The Spring Boot starter works differently. It is a dependency added to the build that brings OpenTelemetry auto-configuration into the Spring application context, wires the SDK and exporters from application properties, and relies on Spring and library integrations present in the classpath. The docs name the agent the default for Spring Boot because it has more out-of-the-box instrumentation, so the starter's coverage is the first thing to verify for your libraries.

Both options export telemetry over OTLP, so the destination is a configuration choice rather than a code choice. In either case the application sends data to an OpenTelemetry Collector or directly to a backend. Route through a Collector wherever possible. The Collector is where you add batching, filtering, redaction and the authentication extensions that protect exporter traffic, and where a change of backend stays a configuration change in the pipeline instead of a redeploy of every service. Confirm the exact OTLP endpoint, protocol and authentication settings for your chosen agent or starter version in the official documentation, since these are set through different keys depending on the option you pick.

Plan for what each mechanism touches before choosing. The agent changes the JVM launch configuration for every service, so platform teams need a standard way to add the flag across images and deployment templates. The starter changes the build and the application's own configuration, so it is reviewed through the normal code and dependency process, which makes it easier to audit but means each service team must upgrade it. Confirm which of your frameworks and drivers each option instruments, and test a representative service in staging before deciding on a single pattern for the estate.

How to set up OpenTelemetry for a Spring Boot service

This sequence takes one Spring Boot service from build type and instrumentation choice to a verified trace in your backend, with a check at each step. It is written for the platform or application team that will own the service after the work is done.

  1. Confirm the build type and runtime

    Start by checking whether the service runs on a standard JVM or is compiled to a native image with GraalVM. Look at the build file and the deployment artifact, and record the Spring Boot version and the JDK in use. A native image is the case where the starter is the recommended path, so this answer decides the rest of the sequence. Done when the team can state the build type, runtime and Spring Boot version in one line that the change record can reference.

  2. Choose the agent or the starter

    Apply the criteria from the topic: use the Java agent for a standard JVM service where its broader out-of-the-box instrumentation matters, and use the Spring Boot starter for native images, services where agent startup overhead is too high, services that already run another Java monitoring agent, or teams that want configuration in application.properties or application.yml. Record the decision and the reason, since it sets the artifact and configuration keys used in later steps. Confirm the choice with the owner of any existing monitoring agent before proceeding.

  3. Add the artifact or attach the agent

    For the starter, add the OpenTelemetry Spring Boot starter dependency to the build and rebuild the service. For the Java agent, download the agent jar and add it as a JVM argument at startup in the launch script or container image. Check the build output or the startup log for the OpenTelemetry instrumentation message, which confirms the component loaded. If the build fails or the message is absent, stop and resolve the dependency or launch configuration before touching the backend.

  4. Set service name and OTLP endpoint

    Set the service name and the OTLP exporter endpoint through configuration rather than code. With the starter, use keys in application.properties or application.yml. With the agent, use OpenTelemetry environment variables or system properties. Point the endpoint at a Collector or at the backend endpoint your organization has approved, and confirm the exact key names against the current Spring Boot starter documentation for the version in use. Done when the effective configuration, printed or logged at startup, shows the intended service name and endpoint.

  5. Deploy a Collector or confirm the backend endpoint

    Decide whether this service sends directly to a backend or through a Collector. A Collector running as an agent next to the service or as a gateway for many sources is the usual pattern for centralized processing and credential handling. If a Collector is used, deploy it with a configuration that you have reviewed, bind its receivers only to the interfaces you intend, and confirm it is reachable from the service. Done when a test request from the service host reaches the Collector or backend endpoint without error.

  6. Generate traffic and verify the trace

    Send a few requests through the service, then open the tracing backend and search for the service name set in the previous step. Confirm that traces appear, that the service name matches exactly, and that expected spans are present for inbound HTTP requests and for the calls the service makes, such as database or downstream HTTP calls. Compare the span set against what the starter or agent covers for your libraries. Done when a sample trace shows the correct service name and the spans you expected, and the team has recorded that check.

  7. Roll back if another Java agent conflicts

    If the service already runs another Java monitoring agent, or the new instrumentation causes errors or duplicate spans, remove the newly added artifact or JVM argument and restart the service to return to the known state. Then decide with the owner of the existing agent whether to keep one agent, switch to the starter, or change the configuration. Record the rollback steps before the first rollout so the on-call team can run them quickly. Done when the service starts cleanly on its prior configuration and the conflict is written up with a chosen path.

How Spring Boot telemetry flows to the Collector

The service starts with either the Java agent attached at JVM startup or the Spring Boot starter on the classpath, and both produce the same OTLP telemetry. Data leaves the application network over OTLP to a Collector running as an agent beside the service or as a gateway, which then exports to a backend your team chooses. Check the trust boundary where data crosses into the Collector, and confirm which side owns the Collector's configuration, authentication and receiver bindings.

Both instrumentation options send OTLP to the same Collector, which exports to your backend.

Security and operational considerations for Spring Boot telemetry

Whichever route you pick, the telemetry it produces leaves the application and lands in a Collector that holds credentials, receives network traffic and forwards data to a backend. The cards below cover the controls to set on that path and the upkeep that keeps the Java side and the Collector working together.

Store Collector configuration securely

Collector configuration often contains backend endpoints, API tokens and authentication settings, so treat it as a secret-bearing artifact. Keep it in a secrets store or an encrypted volume, limit who can read or change it, and review it through the same change process as application code. Check that Spring Boot property files and environment variables holding exporter credentials are not committed to source control or printed in startup logs.

Collector best practices

Encrypt and authenticate endpoints

Traffic from the Java agent or starter to the Collector, and from the Collector to the backend, should be encrypted and authenticated. Collector authenticator extensions can check incoming connections, for example with OIDC, and add credentials to outgoing exporter requests. Confirm which receivers and exporters your chosen Collector build supports before you design the trust boundary.

Bind receivers deliberately

Since Collector v0.110.0, server components bind to localhost by default rather than to all interfaces. A Spring Boot service running in a separate container or pod will not reach a Collector bound to localhost, so the receiver address must be set on purpose. Expose only the ports the applications need, and restrict them with network policy or firewall rules.

Redact sensitive attributes

Spring Boot services can attach HTTP headers, query strings, SQL text and user identifiers to spans and logs. Use the Collector redaction processor to remove or mask attributes that carry personal data, tokens or secrets before export. Test the rules against real sample spans in a non-production environment, because a missed attribute usually reaches the backend unchanged.

Build only the components you need

Collector releases ship a contrib distribution with many components, and each one adds code to review and patch. Use the Collector Builder to produce a distribution with only the receivers, processors and exporters your design requires. Confirm the stability level of each chosen component in its README, since core components have mixed stability.

Track Collector and agent releases together

Collector releases arrive often, and v0.161.0 (September 16, 2026), v0.162.0 (September 29) and v0.163.0 (October 16, 2026) are examples of that cadence. Keep the Java agent or starter version aligned with the Collector's OTLP expectations, and test both together in staging before each upgrade. Verify release artifacts using the published checksums and SBOM files.

Collector releases

Questions teams ask before choosing or rolling out OpenTelemetry for Spring Boot

Does the Spring Boot starter or the Java agent cost more to run?

Neither option carries a license fee, so the running cost comes from resources and effort. The Java agent attaches to the JVM at startup and instruments libraries at the bytecode level, which adds startup time and some memory and CPU overhead that your team should measure in your own environment. The starter is compiled into the application as dependencies and configuration, so its overhead depends mostly on how many instrumentations you enable. Ask the partner to show how each option will be measured against your services, and to state who maintains the dependency versions and the Collector that receives the data, since those are recurring costs.

How long does a first OpenTelemetry rollout on Spring Boot take?

The duration depends on the number of services, how many build pipelines must change, and whether a Collector already exists. A single service with an existing Collector is a much smaller job than a fleet of services that each need a dependency change, a new container image and a new environment variable set. Other drivers include how many backends receive data, whether sensitive attributes must be filtered before export, and how many teams must agree on naming. Ask for a written scope that lists the services, the environments, the Collector topology and the acceptance checks, and tie the timeline to those items rather than to a generic estimate.

What must our team provide before the engagement starts?

Plan to provide access and decisions, not just time. The usual inputs are source access or build pipeline access for each service, a place to run the OpenTelemetry Collector (on Kubernetes, virtual machines or another platform you operate), and credentials or endpoints for the backend that stores traces, metrics and logs. You also need a named owner who can approve changes to application configuration and a change window for production. Put these dependencies in the written scope so that a delay in one of them is visible and does not silently extend the timeline.

Can our own engineers roll out the Spring Boot starter without a partner?

Yes, for a small number of services with a stable build process and engineers who already know Spring Boot configuration. The starter is configured through application properties or YAML, and the Java agent is configured through JVM options and environment variables, so both are within the reach of a platform team. The harder parts are consistent naming, Collector security settings, sampling decisions and verification across environments. If you lack experience with those areas, a partner can plan and implement the pattern once and hand over runbooks, so your team can repeat it for the remaining services.

What happens when a Spring Boot service already runs another Java monitoring agent?

Check first whether the existing agent and the OpenTelemetry instrumentation will both modify the same libraries, because two bytecode agents on one JVM can conflict or duplicate spans. The OpenTelemetry documentation recommends the Spring Boot starter when another Java monitoring agent is already in use, which avoids adding a second agent to the JVM. Confirm in a test environment that trace context propagates correctly across calls, that metrics are not doubled and that the existing agent keeps working. Ask the partner to document the decision and the rollback steps for each affected service.

Which Spring Boot settings should we verify before going to production?

Verify the exporter endpoint, the service name, the sampling settings and the propagation format, because these determine whether data arrives and whether traces connect across services. Confirm that the Collector accepts connections only from the expected networks and that any authentication required by your environment is configured on both sides. Check that sensitive attributes such as query parameters or request headers are removed before export, and confirm the startup time and memory use of a representative service against your own baseline. Record each check in the scope so that acceptance is objective.

Does a DeployOpen engagement include running the telemetry backend?

DeployOpen's work is limited to self-hosted open-source platforms inside your infrastructure, and OpenTelemetry itself is not a backend, so storage and visualization are separate components. An engagement can cover the instrumentation of your Spring Boot services and the Collector pipelines that carry their data, with the backend connected as a defined integration. Whether the backend itself is in scope is a question for the written scope. Confirm the boundary, the owner of each component and the support arrangement before work starts.

Official OpenTelemetry sources for Spring Boot and the Collector

Start with the Spring Boot starter documentation before you choose between the Java agent and the starter. It sets out the decision points this page covers: the agent is the default for Spring Boot because it offers more out-of-the-box instrumentation, while the starter is recommended for native images, for services where agent startup overhead is too high, for teams already running another Java monitoring agent, and for teams that want configuration in application.properties or application.yml. Read it alongside your own service inventory so each decision is checked against the libraries and runtime your services actually use. Confirm against the current documentation whether any listed instrumentation has changed since your last review, because coverage differs between the two options.

The next read for configuration is the Collector configuration documentation, which explains the receivers, processors, exporters and extensions that your application settings will point at. Whichever instrumentation path you pick, the exporter endpoint and protocol are set in the application, and the Collector decides what happens to the data after it arrives. Plan the endpoint, the receiver ports and the authentication extensions together so that the Spring Boot services and the Collector agree on them before rollout. Ask your team to confirm which Collector release and distribution they will deploy, since component stability varies and is documented per component.

For hardening, read the Collector configuration best practices. It covers storing configuration securely, encrypting and authenticating connections, building a Collector with only the components you need, and removing sensitive attributes with the redaction processor. These controls matter for Spring Boot services because application telemetry often carries request paths, user identifiers and query parameters. Review the guidance with your security team before the first production export, and treat the Collector's listening addresses and authentication settings as part of the same change as the application configuration.

How DeployOpen scopes and delivers OpenTelemetry for Spring Boot

DeployOpen treats the agent or starter choice as a scoped decision made against your services, runtime constraints and monitoring estate, then implements the chosen path inside your own infrastructure. The work is documented and handed over so your team can run it, change it and review it without depending on us.

How we scope

  • Inventory Spring Boot services, JVM versions, native image needs and startup budgets before choosing agent or starter for each service.
  • Identify any other Java monitoring agent already attached to production services and plan how the two will coexist or be replaced.
  • Agree in writing which services, environments, configuration sources and Collector endpoints the fixed-scope engagement covers.

How we build

  • Attach the Java agent or add the starter to a non-production service first, then compare startup time and emitted spans against a baseline.
  • Move configuration into application.properties or application.yml where the starter is chosen, keeping secrets out of source control.
  • Test trace export to the Collector, check span names and attributes, and confirm that sensitive values are not captured before rollout.

How we hand over

  • Deliver a decision record for each service stating the chosen path, the reasons and the conditions that would justify switching.
  • Document build files, configuration keys, environment variables and rollback steps so your platform team can repeat the setup.
  • Run a handover session with your developers and operators, and provide written runbooks for upgrades of the agent or starter.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after the initial handover.
  • Review new OpenTelemetry Java agent and Spring Boot starter releases against your services before you adopt them.
  • Ask any quote to separate one-time setup effort from recurring support, upgrade testing and Collector operations costs.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.