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

processes: autodetect service name from node package.json

Open amarziali opened this issue 1 year ago • 11 comments
trafficstars

What does this PR do?

Improve the service name extraction algorithm by adding an heuristic on nodejs processes. It finds the nearest package js starting from the directory where the js entrypoint script resides walking up till the root until a package.js is found. Then it takes the value of the name field.

This algorithm is the standard one implemented in the js tracer. Here we're aligning to it.

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

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

amarziali avatar Feb 14 '24 15:02 amarziali

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 10a23048-c18e-4924-ae68-d3ad41caf647 Baseline: ccfc50490988fee22cafc0a11ec127aa2ca6327a Comparison: a320911035cb71231599da01fbd618a680505320

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

Experiments with missing or malformed data

  • basic_py_check

Usually, this warning means that there is no usable optimization goal data for that experiment, which could be a result of misconfiguration.

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.25 [-6.30, +6.79]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_tree memory utilization +1.17 [+1.05, +1.29]
otel_to_otel_logs ingress throughput +1.06 [+0.41, +1.71]
idle memory utilization +0.92 [+0.88, +0.97]
process_agent_standard_check memory utilization +0.43 [+0.39, +0.48]
process_agent_standard_check_with_stats memory utilization +0.41 [+0.35, +0.46]
file_to_blackhole % cpu utilization +0.25 [-6.30, +6.79]
uds_dogstatsd_to_api_cpu % cpu utilization +0.13 [-1.33, +1.58]
trace_agent_json ingress throughput +0.03 [+0.01, +0.06]
trace_agent_msgpack ingress throughput +0.03 [+0.01, +0.04]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
process_agent_real_time_mode memory utilization -0.28 [-0.33, -0.24]
tcp_syslog_to_blackhole ingress throughput -1.37 [-1.43, -1.30]

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 Feb 14 '24 17:02 pr-commenter[bot]

Go Package Import Differences

Baseline: 06321a2ec53270337eb29a9fbe60ac68e923ba53 Comparison: 7a63b7b9f557ab74d1278c0eb2b0671d43264b95

binaryosarchchange
process-agentlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/pkg/process/metadata/parser/nodejs
process-agentlinuxarm64
+1, -0
+github.com/DataDog/datadog-agent/pkg/process/metadata/parser/nodejs
process-agentwindowsamd64
+1, -0
+github.com/DataDog/datadog-agent/pkg/process/metadata/parser/nodejs
process-agentdarwinamd64
+1, -0
+github.com/DataDog/datadog-agent/pkg/process/metadata/parser/nodejs
process-agentdarwinarm64
+1, -0
+github.com/DataDog/datadog-agent/pkg/process/metadata/parser/nodejs
heroku-process-agentlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/pkg/process/metadata/parser/nodejs

cit-pr-commenter[bot] avatar Feb 15 '24 08:02 cit-pr-commenter[bot]

@amarziali why is the PR based on the java spring parsing? I think you should base the logic on top of main and make it to the mainline

guyarb avatar Feb 28 '24 04:02 guyarb

CLA assistant check
All committers have signed the CLA.

bits-bot avatar Feb 28 '24 10:02 bits-bot

/merge

amarziali avatar Feb 28 '24 17:02 amarziali

:steam_locomotive: MergeQueue

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 28 '24 17:02 dd-devflow[bot]

/merge -c

amarziali avatar Feb 28 '24 17:02 amarziali

:warning: MergeQueue

This merge request was unqueued

If you need support, contact us on Slack #ci-interfaces!

dd-devflow[bot] avatar Feb 28 '24 17:02 dd-devflow[bot]

/merge

amarziali avatar Feb 28 '24 17:02 amarziali

:steam_locomotive: MergeQueue

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 28 '24 17:02 dd-devflow[bot]

:warning: MergeQueue

This merge request was unqueued

If you need support, contact us on Slack #ci-interfaces!

dd-devflow[bot] avatar Feb 28 '24 21:02 dd-devflow[bot]

/remove

guyarb avatar Feb 29 '24 03:02 guyarb

/merge

amarziali avatar Feb 29 '24 09:02 amarziali

:steam_locomotive: MergeQueue

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 29 '24 09:02 dd-devflow[bot]

/merge -c

amarziali avatar Feb 29 '24 09:02 amarziali

:warning: MergeQueue

This merge request was unqueued

If you need support, contact us on Slack #ci-interfaces!

dd-devflow[bot] avatar Feb 29 '24 09:02 dd-devflow[bot]

/merge

amarziali avatar Feb 29 '24 09:02 amarziali

:steam_locomotive: MergeQueue

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 29 '24 09:02 dd-devflow[bot]

/merge -c

amarziali avatar Feb 29 '24 11:02 amarziali

:warning: MergeQueue

This merge request was unqueued

If you need support, contact us on Slack #ci-interfaces!

dd-devflow[bot] avatar Feb 29 '24 11:02 dd-devflow[bot]

We have an E2E test for nodejs here, does it need to be updated?

It's a good call. I preferred to keep as it for non regressions since the new logic is behind a feature flag so by default it should not change

Also, what's the reason for adding this behind a config flag? Do we plan to make this algorithm the default for nodejs eventually?

The reason I know is that this algorithm is also linked to the way automatic injection is inferring the service name and we want to put it behind a feature flag in order to control how this can be rolled out not to impact existing customer on metrics / monitors that can then break

amarziali avatar Feb 29 '24 17:02 amarziali

/merge

amarziali avatar Feb 29 '24 19:02 amarziali

:steam_locomotive: MergeQueue

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 29 '24 19:02 dd-devflow[bot]

:steam_locomotive: MergeQueue

Added to the queue.

This build is going to start soon! (estimated merge in less than 50m)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 29 '24 20:02 dd-devflow[bot]