Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASM Standalone #2903

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

ASM Standalone #2903

wants to merge 32 commits into from

Conversation

estringana
Copy link
Contributor

Description

Work in progress

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.82%. Comparing base (35d1665) to head (a42e4ad).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2903   +/-   ##
=========================================
  Coverage     74.82%   74.82%           
  Complexity     2741     2741           
=========================================
  Files           110      110           
  Lines         10863    10863           
=========================================
  Hits           8128     8128           
  Misses         2735     2735           
Flag Coverage Δ
tracer-php 74.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35d1665...a42e4ad. Read the comment docs.

---- 🚨 Try these New Features:

@pr-commenter
Copy link

pr-commenter bot commented Oct 18, 2024

Benchmarks [ tracer ]

Benchmark execution time: 2024-11-22 15:43:31

Comparing candidate commit a42e4ad in PR branch estringana/asm-standalone-2 with baseline commit 35d1665 in branch master.

Found 2 performance improvements and 0 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics.

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟩 execution_time [-5.365µs; -3.755µs] or [-3.160%; -2.212%]

scenario:TraceFlushBench/benchFlushTrace

  • 🟩 execution_time [-1000.000ns; -1000.000ns] or [-50.000%; -50.000%]

@estringana estringana force-pushed the estringana/asm-standalone-2 branch 3 times, most recently from 5feaef4 to 522e841 Compare October 24, 2024 13:31
@pr-commenter
Copy link

pr-commenter bot commented Oct 24, 2024

Benchmarks [ appsec ]

Benchmark execution time: 2024-11-21 16:43:12

Comparing candidate commit 8095baa in PR branch estringana/asm-standalone-2 with baseline commit 35d1665 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.

@estringana estringana force-pushed the estringana/asm-standalone-2 branch 3 times, most recently from 5149b34 to 5d05f77 Compare October 25, 2024 09:31
@estringana estringana force-pushed the estringana/asm-standalone-2 branch 6 times, most recently from 4b42290 to b068df8 Compare November 8, 2024 15:04
if (Z_TYPE_P(rule) != IS_ARRAY) {
continue;
}
if (!get_global_DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED()) { // APPSEC_STANDALONE enabled, override sampling rules to be empty
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just wrap the code within if (!get_global_DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED()) {

@estringana estringana force-pushed the estringana/asm-standalone-2 branch 2 times, most recently from 3a73d3b to a93f131 Compare November 14, 2024 11:21
return false;
}

zval *root_span = zend_hash_index_find(Z_ARR_P(trace), 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by the way ddtrace is currently designed, the root span will (almost?) always be the first span.
But that's more by coincidence that the root span just happens to be the last span closed - and spans are serialized in reverse order.
This may or may not change in future via normal refactors. (?)
We should at least note somewhere that we rely on that being the case now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. How would you go approach this then? I'm ok to implement it properly if it does not require any major refactoring

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not suggesting to actually change it, but primarily to document that you rely on this now.

@estringana estringana force-pushed the estringana/asm-standalone-2 branch 3 times, most recently from 57ade7e to 7fc63bc Compare November 20, 2024 11:19
return false;
}

atomic_store(&dd_limiter->window.last_hit, timeval);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it doesn't matter if there's a possible race condition where two requests hit this at the same time. The worst which will happen is that rarely two traces are sent.
(Otherwise one could do a cmpxchg here.)

@estringana estringana marked this pull request as ready for review November 22, 2024 09:09
@estringana estringana requested review from a team as code owners November 22, 2024 09:09
@estringana estringana changed the title [DRAFT] ASM Standalone ASM Standalone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants