Transaction counts are crucial for understanding application performance. However, discrepancies between APM Insight-reported and application-reported counts can cause confusion. This article explores common causes and solutions for these mismatches, aiming for a 99% to 100% match after adjustments.
Causes of Transaction Count Mismatch
-
Sampling Factor: APM Insight tracks only a subset of requests to reduce overhead. The Sampling Factor in the agent configuration profile is a 1-in-N counter, not a percentage — a value of 3 means the agent instruments 1 in every 3 requests of the same kind. Newly created agent configuration profiles default to 3, so some sampling is active out of the box. Setting the factor to 1 tracks every request and is what aligns the counts to a 99% to 100% match.
-
Smart Sampling (Java agent only): When enabled, the Java agent automatically increases the sampling factor based on the real-time CPU and memory consumption of the JVM. Under load the effective factor can become a multiple of the configured value, so the tracked share of requests varies with load rather than staying fixed.
- Configuration Issues: Misconfigurations in the agent configuration profile or application settings can lead to incorrect data collection. This includes filters, exclusions, and incorrect threshold settings.
- Network Latency: Delays or losses in data transmission between the application and the APM Insight agent can affect transaction reporting.
- Data/Time Aggregation: Differences in how data is aggregated and reported by our agent compared to the application can cause discrepancies. APM tools often use different time windows or aggregation methods, resulting in these differences. There could be maximum of 1 or 2 minutes difference between data collection and reporting times.
- Calculation Differences: Custom time ranges set in Applications Manager may include an extra minute or use different rounding rules, affecting the transaction counts.
Troubleshooting Steps
-
Set the Sampling Factor to 1: In the agent configuration profile, set Sampling Factor to 1 so that every request of every kind is tracked. Compare the counts over a controlled period before deciding whether to restore a higher value. 
Do not enter 100. The field is a 1-in-N counter measured in transactions, not a percentage. A value of 100 tracks only 1 in 100 requests. 1 is the value that tracks everything.
-
Note: Sampling is applied when the request starts, before its outcome is known. Requests that are skipped by sampling are therefore not recorded even if they later fail, which is why counts of errored requests can also fall short of the application's own logs.
-
Disable Smart Sampling (Java agent only): Smart Sampling raises the sampling factor automatically under CPU or memory pressure and can drop transactions. In the agent configuration profile for the Java instance, uncheck the Enable smart sampling checkbox and save. The profile is pushed to the agent from the server, so no agent restart or file edit is required.
Setting smart.sampler.enabled=false in <agent_extracted_path>/apminsight.conf has no effect. Sampling and tracing behaviour is delivered to the agent from the server-side agent configuration profile, which overrides the local file. Always use the Enable smart sampling checkbox in the profile.
-
Smart Sampling exists for the Java agent only. It is not applicable to the .NET, .NET Core, Node.js, PHP, Python or Ruby agents, and the checkbox is not shown for them.
-
Compare Data Collection Methods: Understand the aggregation and filtering methods in both systems. For example, ensure that no transactions are being filtered out or preprocessed in a way that affects the counts.
- Analyze Network Traffic: Monitor for packet loss and network latency.
- Review Logs and Metrics: Look for discrepancies and missing entries.
- Test with Controlled Transactions: Perform controlled tests to compare reported counts. For example, execute a known number of transactions and compare the counts reported by the agent and the application. This can help isolate the source of the mismatch.
- Adjust for Time Aggregation and Calculation Differences: Ensure matching time aggregation settings and custom ranges. For example, be aware that custom time ranges in Applications Manager might include an extra minute or use different rounding rules. Adjust the custom ranges to match the application's reporting periods.
Sampling Controls by Agent Type
All sampling controls live in the agent configuration profile on the Applications Manager server. There is no custom or per-transaction sampling rule for any agent — the Sampling Factor is the only sampling control, with Smart Sampling available additionally on Java.
| Agent |
Sampling Factor |
Smart Sampling |
Custom / per-transaction sampling |
| Java | Yes (set to 1 to track all) | Yes — disable via profile checkbox | Not available |
| .NET, .NET Service, .NET Desktop, .NET Core | Yes (set to 1 to track all) | Not applicable | Not available |
| Node.js | Yes (set to 1 to track all) | Not applicable | Not available |
| PHP, PHP (Windows) | Yes (set to 1 to track all) | Not applicable | Not available |
| Python | Yes (set to 1 to track all) | Not applicable | Not available |
| Ruby | Yes (set to 1 to track all) | Not applicable | Not available |
Transaction Counts vs. Trace Snapshots
These are two different things, and setting the Sampling Factor to 1 fixes only the first:
- Transaction counts and metrics are recorded for every tracked request. With Sampling Factor 1 and Smart Sampling disabled, counts should align with the application's own numbers.
- Trace snapshots (the detailed drill-down under the Traces tab) are captured only for requests that meet a trace condition — response time above the Trace Threshold, an error, a slow SQL statement, a distributed trace, or an external-component count above its threshold. In addition, only the most significant trace per transaction is retained per collection window. A fast, successful request therefore has a count but no trace snapshot, by design. Lowering the Trace Threshold widens trace capture but increases agent and server overhead, and is not recommended on production systems without review.
Additional Considerations
Based on the application load (requests per minute), the mismatch in counts can vary. The percentage discrepancy can range from as low as 0.1% to potentially significant differences, especially under high load conditions. This variability underscores the importance of thorough troubleshooting to identify and correct the root causes.
Conclusion
Transaction count mismatches can be resolved by setting the Sampling Factor to 1, disabling Smart Sampling on Java agents, ensuring complete instrumentation, and aligning data collection methods. By systematically troubleshooting and understanding time aggregation and calculation differences, a 99% to 100% match is achievable, ensuring accurate performance monitoring. Note that this applies to transaction counts; trace snapshots remain condition-based and are not captured for every request.