
Dheeraj Jampani
Senior Engineer, American Family Insurance
At American Family Insurance, as part of our overall infrastructure, we maintain a shared pool of approximately 200 physical servers that run hundreds of Java applications. The JVM infrastructure is maintained by a dedicated team, and the apps running on these JVMs are owned by the application teams. Each of these applications runs as an individual JBoss instance, partitioned across a number of these hosts. This architecture gives us a degree of fault isolation: if one application’s process runs into a problem, it doesn’t take down the others sharing the same host.
Using Single Step Instrumentation (SSI), we brought more than 1,100 Java applications across this shared infrastructure into Datadog Application Performance Monitoring (APM) without changing their underlying code. That was a significant advantage given how many teams and separate deployment processes are involved across our estate. But, due to the specific way our environment is set up, getting there wasn’t straightforward. Once the data started flowing in, we ran into two challenges with the default configuration. First, many of our applications surfaced in Datadog under the same one or two service names, because they shared the same generic JBoss launcher and SSI had no way to tell them apart. Second, SSI’s broad process detection didn’t stop at our applications. It also tried to instrument third-party Java tools sharing the same infrastructure, tools that were never meant to be part of our APM deployment.
Solving both challenges led us to work directly with Datadog’s APM team. Together, we configured SSI to map services accurately in our environment and developed a more precise way to control which processes were automatically instrumented. That collaboration helped shape Instrumentation Rules, a product capability that other teams can use to tailor automatic instrumentation across dense, shared infrastructure.
When “automatic” service detection isn’t specific enough
Single Step Instrumentation works by automatically detecting running processes and attaching the appropriate tracer to it. By default, SSI automatically defines the DD_SERVICE environment variable if one is not explicitly configured. In the case of Java services, it tries to derive a service name from the app’s Java entry point. In our situation, where every app ran in a JBoss JVM instance, SSI saw the same entry point context.
The result was a collapse of trace data from more than 1,100 applications. While approximately 300 got split out because they had servlet context configured, the remainder were grouped under two service names, jboss-modules and root-servlet regardless of which of our applications had actually generated the trace.
We could still view trace data by host, but that view aggregated every application running on that host into a single, incoherent stream. There was no reliable way to know which application a given trace belonged to. Engineers often had to use the request URI to infer which application had generated a trace, limiting the application-level visibility we wanted from APM.
Why our architecture required a different approach
Datadog’s own troubleshooting documentation for SSI describes this exact symptom, multiple sites reporting under the same service name, and recommends a fix: enabling split-by-tags on servlet.context either as a JVM system property -Ddd.trace.split-by-tags=servlet.context or an environment variable DD_TRACE_SPLIT_BY_TAGS=servlet.context.
This is the right fix for the problem it’s designed to solve: several web applications, or “sites,” deployed within a single app-server process, each reachable at its own context path. Our architecture is the opposite. We run one application per JBoss instance, so there was never a reason to configure distinguishing context paths in the first place. The servlet context value was effectively identical, or absent, across the whole estate. Splitting on it wouldn’t have separated our applications; it would have renamed all of them the same way and reproduced the exact same collapse under a different label.
If you’re evaluating this fix for your own environment, the question to ask first is whether you’re dealing with multiple contexts inside one process, or multiple independent processes that all happen to look identical to SSI. The split-by-tags fix solves the first case. We needed something else for the second.
Identifying a real per-process identifier
Since the servlet layer had nothing to offer us, we looked at what was actually unique about each of our JBoss processes: the command-line arguments used to launch them. Each process is started with a partition name and a JVM name, identifiers that are meaningful in our internal systems but invisible to SSI’s default detection.
We brought our findings to Datadog’s APM team: what SSI detected by default, and how it didn’t match the reality of our environment. From there, the collaboration moved through a few stages. The standard service-detection approaches did not map cleanly to the way our environment identified applications, so we worked with the APM team on a configuration-based approach. Together, we worked through a solution built around extracting the partition and JVM name values directly from the command line and tested it internally against our actual infrastructure to confirm it held up at our scale before rolling it out more broadly. The approach came down to three steps:
Extract the identifying fields. We used process tags to pull the partition name and JVM name out of each process’s command-line arguments.
Resolve them to an application name. Those identifiers don’t mean anything on their own; you need context. We cross-referenced them against our internal inventory system, which already maps partition names to the applications running inside them.
Encode the mapping as configuration. We built out an application_monitoring.yaml file that maps each partition/JVM combination to the correct service name, and used service remapping rules to apply it. Below is an example of this configuration:
apm_configuration_default: DD_APPSEC_ENABLED: false DD_DYNAMIC_INSTRUMENTATION_ENABLED: true DD_TRACE_STARTUP_LOGS: falseapm_configuration_rules:- selectors: - origin: process_arguments key: -Damfam.jbossha.partition_pair_name matches: ["partition_name"] operator: equals configuration: DD_SERVICE: service_name-partition_nameWe used Python scripts to generate the necessary YAML files and then push them out to our servers. Because the configuration had to be applied at the server level, we used Python scripts to generate and distribute the YAML files, avoiding changes across hundreds of individual applications. Given that constraint, we rolled it out in small batches: one or two servers at a time. After each batch, we validated that the new service names looked correct and confirmed there were no negative impacts before moving on to the next set of servers.
Once the rollout was complete, the change in visibility was significant. The servlet-context auto-remapping we got out of the box with APM instrumentation had gotten us to around 300 services, although there were some applications that our team wanted to refer to by specific names. With service remapping, we could override the default and mapped services to the more meaningful names defined in application_monitoring.yaml, bringing us to more than 1,100 distinct, correctly named services, a number that closely matches the actual count of applications running across this infrastructure.
The benefit went well beyond naming. With each service showing up in its own distinct bucket, trace context propagation across services became clear for the first time, making it far easier to pinpoint latency, bottlenecks, and errors at the specific service and endpoint responsible, rather than somewhere in an undifferentiated pile of traces. It also meant we could finally build dashboards around the business-critical API endpoints our teams actually cared about: usage, performance, and reliability, tracked at the level that mattered to them.
Refining instrumentation across shared hosts
Correctly identifying our services solved the visibility challenge, but it also helped us refine the scope of our instrumentation. SSI’s broad process detection identified several third-party Java tools on the same servers, including Cribl, Cortex, Autosys, Jenkins, and Siteminder. These tools were outside the scope of our APM deployment, and attempting to instrument them generated unnecessary errors and incident reports. Once we applied instrumentation policies that excluded those processes, the errors stopped.
From full shutdown to targeted rules
We temporarily disabled SSI as a safeguard while we defined a more precise instrumentation policy. That stopped the incidents, but it also meant losing APM coverage across our entire Java estate, which wasn’t sustainable given how much we’d just invested in fixing service detection.
From there, we worked through a few iterations. We first built a policies.yaml file that explicitly denied instrumentation for the specific processes we knew conflicted with Datadog, while allowing everything else by default. But a deny list only protects you from the conflicts you already know about. Every time we adopted a new tool, or a vendor changed how their agent behaved, we risked hitting the same failure mode again with something new. The more durable approach is to invert the model: only instrument the technologies we know we want, in our case Tomcat and JBoss, and deny everything else by default. We’re actively moving in this direction using Instrumentation Rules, which let us define that allow-list behavior directly. Given the number of hosts and processes in this environment, we’re validating the new rule set in stages rather than switching over all at once. Given the scale of the environment, we are validating the rules incrementally to preserve APM coverage across production applications.
This progression, worked through collaboratively with Datadog’s APM team, helped inform Instrumentation Rules: a way to define ordered allow and deny rules for instrumentation, evaluated per process, with a final default rule as a fallback. What started as our own hand-rolled YAML policies is now available functionality within the product that other organizations can use, with rules configurable in the UI instead of pushed as flat files.
What Instrumentation Rules does
The clearest way to describe Instrumentation Rules is that it decides whether Datadog attaches to a process at all, before any tracing happens, not which trace data gets kept or dropped afterward. If a rule denies a process, SSI never injects the Datadog tracing library into it. If a rule allows it, injection proceeds as normal.
This distinction matters because it gives you the same kind of precision that manual, code-level instrumentation always offered (choose exactly what you want visibility into) but layered on top of SSI’s automatic, no-code-changes coverage. You get broad instrumentation by default, and the ability to carve out exceptions, or, as we’re working toward, define the allowed set explicitly, without touching a single application.
Broad APM coverage with greater control
By adapting SSI to our environment, we went from two generic service names to more than 1,100 correctly identified applications, while retaining the ability to deploy APM without changing each application’s code. Instrumentation Rules also gave us more precise control over which processes receive tracing libraries. Together, these capabilities allowed us to combine broad automatic coverage with the control required for a large, shared Java environment.
Our experience highlighted two questions that can help other teams tailor SSI to complex infrastructure:
If multiple applications appear under the same service name: First determine whether the ambiguity exists within a single process or across independent processes that look identical to SSI. Split-by-tags can distinguish multiple contexts within one application server. When separate processes share the same default identifiers, look for a process-level signal that can be mapped to the correct application name.
If SSI identifies processes outside the intended scope: Use Instrumentation Rules to define which processes SSI should allow or deny before the tracing library is attached. This preserves the efficiency of automatic instrumentation while excluding third-party or non-application software.
For teams running Java on shared infrastructure, whether physical servers, VMs, or other environments where many processes share a host, the specific identifiers will vary, but the approach remains the same. Identify the signals that distinguish each application, use service remapping to create meaningful service names, and use Instrumentation Rules to control where SSI attaches. For us, that combination delivered broad, no-code APM coverage without sacrificing the control our environment required.
To learn more, see Datadog’s documentation on Single Step Instrumentation, service remapping, and Instrumentation Rules.
If you’re new to Datadog, you can get started with a 14-day free trial.
