Skip to content

Conversation

@vdeturckheim
Copy link
Contributor

This PR inserts the AppSec processor before the SpanAggregator processor. In fact, the writer runs at the end of this aggregator so any changes to the spans done after this processor won't be sent to the agent.

Replaces #3235 that was coming from a fork

@vdeturckheim vdeturckheim requested a review from a team as a code owner February 10, 2022 09:27
@vdeturckheim vdeturckheim added the changelog/no-changelog A changelog entry is not required for this PR. label Feb 10, 2022
@vdeturckheim
Copy link
Contributor Author

vdeturckheim commented Feb 10, 2022

@Kyle-Verhoog @brettlangdon I have updated the original PR:

  • changed the order of processor instantiations
  • added a snapshot test
  • applied misc comments (updated .gitignore and made processor.py private)

PTAL.
Do you think we can issue a patch release with this fix?

nizox
nizox previously approved these changes Feb 10, 2022
if appsec_enabled:
try:
from .appsec.processor import AppSecSpanProcessor
from .appsec._processor import AppSecSpanProcessor
Copy link
Contributor

Choose a reason for hiding this comment

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

I might have overlooked this in past PRs, but I was wondering if the tracer could implement some API to allow other components to interact with it. This current implementation seems to crate a tight bond between the tracer and AppSec (i.e. the tracer effectively knows about the .appsec module, even if there is a runtime check). This could be broken if the tracer allowed for some generic hooking mechanism, so that it can go on without knowing that .appsec exists. IMHO it's AppSec that should know about the tracer, and not the other way around. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be +1 on that. At some point, doubling down on the gateway should bring us here.
However, we'll need to find a way to abstract writing on spans from these plugins.
Let's fix the current bug and move forward :)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah the idea was/is to expose some kind of API for adding/removing/specifying span processors we just haven't decided on a public API for this so we're keeping things internal to the tracer.

I think right now things are mostly contained in _initialize_span_processors so would be quite easily translated to whatever API we decide on.

brettlangdon
brettlangdon previously approved these changes Feb 10, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 10, 2022

@vdeturckheim this pull request is now in conflict 😩

@mergify mergify bot added the conflict label Feb 10, 2022
@vdeturckheim
Copy link
Contributor Author

@mergify update

@mergify
Copy link
Contributor

mergify bot commented Feb 10, 2022

update

❌ Base branch update has failed

merge conflict between base and head
err-code: EF27C

Hey, I reacted but my real name is @Mergifyio

…essor' into nicolas.vivet/hotfix-appsec-processor
@mergify mergify bot removed the conflict label Feb 10, 2022
if appsec_enabled:
try:
from .appsec.processor import AppSecSpanProcessor
from .appsec._processor import AppSecSpanProcessor
Copy link
Member

Choose a reason for hiding this comment

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

Yeah the idea was/is to expose some kind of API for adding/removing/specifying span processors we just haven't decided on a public API for this so we're keeping things internal to the tracer.

I think right now things are mostly contained in _initialize_span_processors so would be quite easily translated to whatever API we decide on.

@vdeturckheim vdeturckheim dismissed stale reviews from brettlangdon and nizox via 4fc594e February 10, 2022 15:56
@brettlangdon
Copy link
Member

@Mergifyio backport 0.58

@mergify
Copy link
Contributor

mergify bot commented Feb 10, 2022

backport 0.58

🟠 Waiting for conditions to match

  • merged [:pushpin: backport requirement]

@brettlangdon brettlangdon merged commit d89cb93 into master Feb 10, 2022
@brettlangdon brettlangdon deleted the nicolas.vivet/hotfix-appsec-processor branch February 10, 2022 16:07
mergify bot pushed a commit that referenced this pull request Feb 10, 2022
* Run the AppSec processor before the writer

* fix order issue - understand snapshot tests

* fmt pass

* try to enable snapshot for appsec

* try to enable snapshot for appsec

* try to enable snapshot for appsec

* update snapshot

* update snapshot

* update snapshot

* revert breaking change

Co-authored-by: Nicolas Vivet <nicolas.vivet@datadoghq.com>
(cherry picked from commit d89cb93)
@mergify
Copy link
Contributor

mergify bot commented Feb 10, 2022

backport 0.58

✅ Backports have been created

brettlangdon pushed a commit that referenced this pull request Feb 10, 2022
* Run the AppSec processor before the writer

* fix order issue - understand snapshot tests

* fmt pass

* try to enable snapshot for appsec

* try to enable snapshot for appsec

* try to enable snapshot for appsec

* update snapshot

* update snapshot

* update snapshot

* revert breaking change

Co-authored-by: Nicolas Vivet <nicolas.vivet@datadoghq.com>
(cherry picked from commit d89cb93)

Co-authored-by: Vladimir de Turckheim <vdeturckheim@users.noreply.github.com>
@mabdinur mabdinur mentioned this pull request Feb 15, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants