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

Refacto logger's code

Open louis-cqrl opened this issue 1 year ago • 4 comments

What does this PR do?

This PR remove duplicated code and align lock logic to every function, moreover function that work on same part of the logger are group together to make the research inside this file easier

Motivation

Due to last changes in the logger to avoid data race, the code was a bit messy, this PR is here to make the code easier to read and understand.

Additional Notes

Possible Drawbacks / Trade-offs

Due to the add of sub-function, according to the number of call on this function the execution may be slower

Describe how to test/QA your changes

Run the Agent, Check if logs print correctly. Run the Agent, check if there is no data race

louis-cqrl avatar Mar 12 '24 16:03 louis-cqrl

/trigger-ci --variable RUN_ALL_BUILDS=true --variable RUN_KITCHEN_TESTS=true --variable RUN_E2E_TESTS=on --variable RUN_UNIT_TESTS=on

louis-cqrl avatar Mar 13 '24 08:03 louis-cqrl

:steam_locomotive: Gitlab pipeline started

Started pipeline #30007333

dd-devflow[bot] avatar Mar 13 '24 08:03 dd-devflow[bot]

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 2d420db1-0d2f-43f2-b68b-92472a3c41e1 Baseline: e90560f2c8c77b2f8b39caeb6fd548e607885967 Comparison: 96775da3454de767746f92274a7ab390fe49e36b

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 +2.59 [-4.11, +9.30]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +2.59 [-4.11, +9.30]
basic_py_check % cpu utilization +1.93 [-0.42, +4.27]
file_tree memory utilization +0.68 [+0.57, +0.78]
process_agent_real_time_mode memory utilization +0.38 [+0.33, +0.43]
process_agent_standard_check memory utilization +0.03 [-0.01, +0.07]
otel_to_otel_logs ingress throughput +0.02 [-0.39, +0.44]
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.00, +0.00]
trace_agent_json ingress throughput -0.01 [-0.02, +0.00]
trace_agent_msgpack ingress throughput -0.02 [-0.03, -0.01]
uds_dogstatsd_to_api ingress throughput -0.03 [-0.24, +0.17]
process_agent_standard_check_with_stats memory utilization -0.22 [-0.26, -0.18]
idle memory utilization -0.71 [-0.75, -0.66]
tcp_syslog_to_blackhole ingress throughput -0.75 [-0.85, -0.65]
pycheck_1000_100byte_tags % cpu utilization -1.31 [-6.48, +3.86]
uds_dogstatsd_to_api_cpu % cpu utilization -2.98 [-5.82, -0.15]

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 13 '24 09:03 pr-commenter[bot]

PS: thanks for the proper commit splitting, made reviewing much easier !

pgimalac avatar Mar 13 '24 11:03 pgimalac

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=30162616 --os-family=ubuntu

pr-commenter[bot] avatar Mar 15 '24 09:03 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: 28673114-4f58-45ae-9c64-ed1a13a445bb Baseline: 76679b38fc94092cb330c58620040143c5136b94 Comparison: 88e794ed730ddbd7e2c322db7b7e93d9f59a9938

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.94 [-7.28, +5.39]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
tcp_syslog_to_blackhole ingress throughput +1.14 [+1.05, +1.22]
uds_dogstatsd_to_api_cpu % cpu utilization +0.86 [-1.86, +3.58]
basic_py_check % cpu utilization +0.42 [-2.03, +2.88]
process_agent_standard_check memory utilization +0.38 [+0.34, +0.41]
process_agent_standard_check_with_stats memory utilization +0.30 [+0.27, +0.33]
process_agent_real_time_mode memory utilization +0.08 [+0.05, +0.11]
trace_agent_msgpack ingress throughput +0.02 [+0.01, +0.02]
pycheck_1000_100byte_tags % cpu utilization +0.02 [-4.91, +4.94]
trace_agent_json ingress throughput +0.00 [-0.02, +0.03]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.20, +0.20]
tcp_dd_logs_filter_exclude ingress throughput -0.02 [-0.05, +0.01]
otel_to_otel_logs ingress throughput -0.22 [-0.67, +0.22]
idle memory utilization -0.24 [-0.27, -0.20]
file_tree memory utilization -0.30 [-0.40, -0.21]
file_to_blackhole % cpu utilization -0.94 [-7.28, +5.39]

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 15 '24 09:03 pr-commenter[bot]

/merge

louis-cqrl avatar Mar 15 '24 15:03 louis-cqrl

:steam_locomotive: MergeQueue

Pull request added to the queue.

There are 4 builds ahead! (estimated merge in less than 27m)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Mar 15 '24 15:03 dd-devflow[bot]