datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

processes: add language detection for weblogic and JEE ear deployments

Open amarziali opened this issue 2 years ago • 4 comments

What does this PR do?

This PR brings the first milestone for Java enterprise server service detection, by enabling

  • server vendor detection (i.e. jboss, weblogic, tomcat,...)
  • list of deployed application context root extraction

Please note that this extraction is opt in (system_probe_config.process_service_inference.use_improved_algorithm has to be explicitly set to true)

Some preamble

An application server is usually able to run multiple application at the same time. When APM instruments an application server, by default it uses the root context of a web application as service name.

The root context is a sort of base path the application is serving requests. It can be defined in a couple of ways:

  • The deployment is an EAR. It means that is an archive containing other archives (.war). It contains a file (application.xml) that maps each webapp to its root context. This is standardised across vendors
  • The deployment is a WAR. In this case each vendor has a specific way to express the context root. As a default, the filename without the extension is commonly used as context root.

In order to know which application are deployed on an application server being executed, there is the need to parse the vendor specific configuration in order to see which applications are enabled for the deployment.

Vendor detection algorithm

The algorithm cycles through the cmd line and looks for a couple of evidences in order to be sure that the matching is correct. Generally we match:

  1. The main class entrypoint / jar name
  2. A typical system properties defined by the server cmd line (typically the domain home, used also later on).

If mismatch, unknown will be returned

Generic Java Enterprise context extraction

  1. Determine the vendor
  2. Extract the deployments (ear and war only) for the current server from the config (can be archives or directories)
  3. Extract the context root for each deployment
  4. for an EAR use the application.xml file
  5. for a WAR first use the vendor specific method, then the default one (can be based on the filename or more complex like for tomcat)

Specific war context root extraction for weblogic

Weblogic war file can define their context root by specifying it on a file called weblogic.xml

Reporting process_context for that multiservice use case

All the context roots are reported as service names. This implies as many process_context:x tags. If the context roots cannot be extracted but the server vendor can be detected, the server vendor name will be used

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

amarziali avatar Mar 08 '24 11:03 amarziali

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: c2749b57-60bb-4e8f-a950-a9e46241963e Baseline: 9923959a6525bc1dd4576ec3a682daec6e717f5a Comparison: fb56b9a8abc97a0551151813e1463a7f0bd9ee59

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.91 [-5.65, +7.46]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
tcp_syslog_to_blackhole ingress throughput +0.97 [+0.91, +1.02]
file_to_blackhole % cpu utilization +0.91 [-5.65, +7.46]
otel_to_otel_logs ingress throughput +0.77 [+0.12, +1.42]
process_agent_standard_check_with_stats memory utilization +0.34 [+0.29, +0.38]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
trace_agent_msgpack ingress throughput -0.01 [-0.02, -0.01]
trace_agent_json ingress throughput -0.02 [-0.05, +0.01]
basic_py_check % cpu utilization -0.09 [-2.37, +2.19]
process_agent_real_time_mode memory utilization -0.14 [-0.19, -0.10]
process_agent_standard_check memory utilization -0.25 [-0.29, -0.20]
idle memory utilization -0.34 [-0.38, -0.29]
file_tree memory utilization -0.83 [-0.92, -0.74]
uds_dogstatsd_to_api_cpu % cpu utilization -1.57 [-3.00, -0.14]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

pr-commenter[bot] avatar Mar 08 '24 12:03 pr-commenter[bot]

Go Package Import Differences

Baseline: 760ecea30cc9902326f029fe7793b4d148f63fec Comparison: f7e132a62030cf4eacb22d1372c346b76f459f82

binaryosarchchange
agentlinuxamd64
+1, -0
+github.com/spf13/afero/zipfs
agentlinuxarm64
+1, -0
+github.com/spf13/afero/zipfs
agentwindowsamd64
+1, -0
+github.com/spf13/afero/zipfs
agentwindows386
+1, -0
+github.com/spf13/afero/zipfs
agentdarwinamd64
+1, -0
+github.com/spf13/afero/zipfs
agentdarwinarm64
+1, -0
+github.com/spf13/afero/zipfs
iot-agentlinuxamd64
+1, -0
+github.com/spf13/afero/zipfs
iot-agentlinuxarm64
+1, -0
+github.com/spf13/afero/zipfs
heroku-agentlinuxamd64
+1, -0
+github.com/spf13/afero/zipfs
process-agentlinuxamd64
+1, -0
+github.com/spf13/afero/zipfs
process-agentlinuxarm64
+1, -0
+github.com/spf13/afero/zipfs
process-agentwindowsamd64
+1, -0
+github.com/spf13/afero/zipfs
process-agentdarwinamd64
+1, -0
+github.com/spf13/afero/zipfs
process-agentdarwinarm64
+1, -0
+github.com/spf13/afero/zipfs
heroku-process-agentlinuxamd64
+1, -0
+github.com/spf13/afero/zipfs

cit-pr-commenter[bot] avatar Mar 08 '24 13:03 cit-pr-commenter[bot]

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=30271394 --os-family=ubuntu

pr-commenter[bot] avatar Mar 14 '24 17:03 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: 77da9e88-fd5d-4d3b-af30-34a1a7c1cae9 Baseline: 760ecea30cc9902326f029fe7793b4d148f63fec Comparison: a48c35c1c46cbf2bc12f60609a08d4fae73bee83

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.78 [-5.61, +7.17]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
uds_dogstatsd_to_api_cpu % cpu utilization +1.13 [-1.64, +3.91]
file_to_blackhole % cpu utilization +0.78 [-5.61, +7.17]
process_agent_standard_check memory utilization +0.66 [+0.63, +0.69]
idle memory utilization +0.46 [+0.43, +0.50]
process_agent_standard_check_with_stats memory utilization +0.39 [+0.36, +0.41]
tcp_syslog_to_blackhole ingress throughput +0.35 [+0.26, +0.43]
file_tree memory utilization +0.27 [+0.19, +0.36]
process_agent_real_time_mode memory utilization +0.20 [+0.16, +0.24]
otel_to_otel_logs ingress throughput +0.13 [-0.32, +0.58]
pycheck_1000_100byte_tags % cpu utilization +0.00 [-4.96, +4.96]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.20, +0.20]
trace_agent_msgpack ingress throughput -0.00 [-0.00, +0.00]
trace_agent_json ingress throughput -0.00 [-0.03, +0.03]
tcp_dd_logs_filter_exclude ingress throughput -0.01 [-0.03, +0.01]
basic_py_check % cpu utilization -1.76 [-4.15, +0.64]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

pr-commenter[bot] avatar Mar 14 '24 17:03 pr-commenter[bot]