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

Adding weblog tests for TRACE_CLIENT_IP_ENABLED Configuration #3657

Merged
merged 8 commits into from
Dec 13, 2024

Conversation

mhlidd
Copy link
Contributor

@mhlidd mhlidd commented Dec 10, 2024

Motivation

Adding tests for tracing configs to make sure implementation across all languages are consistent, based upon the following RFC.

Changes

  • Add test case for when DD_TRACE_CLIENT_IP_ENABLED is set to false and DD_TRACE_CLIENT_IP_HEADER is specified
  • Updated all manifest files in order to reflect the current expected behavior of the tests
    APMAPI-943

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes (if something not related to your task is failing, you can ignore it)
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner. We're working on refining the codeowners file quickly.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • If PR title starts with [<language>], double-check that only <language> is impacted by the change
  • No system-tests internal is modified. Otherwise, I have the approval from R&P team
  • CI is green, or failing jobs are not related to this change (and you are 100% sure about this statement)
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added (or removed)?

weblog_env={"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false"},
weblog_env={
"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false",
"DD_TRACE_CLIENT_IP_ENABLED": "false",
Copy link
Contributor

Choose a reason for hiding this comment

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

default behavior is false, so no need to add this for the Test_Config_ClientIPHeaderEnabled_False test

@mhlidd mhlidd requested a review from khanayan123 December 11, 2024 18:40
@mhlidd mhlidd marked this pull request as ready for review December 11, 2024 19:12
@mhlidd mhlidd requested review from a team as code owners December 11, 2024 19:12
@mhlidd mhlidd requested review from gnufede, vitor-de-araujo, manuel-alvarez-alvarez, jandro996 and dmehala and removed request for a team December 11, 2024 19:12
@scenarios.tracing_config_nondefault_3
@features.tracing_configuration_consistency
class Test_Config_ClientIPHeaderEnabled_False:
"""Verify headers containing ips are not tagged when DD_TRACE_CLIENT_IP_ENABLED=false
Copy link
Contributor

Choose a reason for hiding this comment

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

We should update the comment to state DD_TRACE_CLIENT_IP_ENABLED=false is default behavior. So Verify headers containing ips are not tagged by default

Copy link
Collaborator

@robertomonteromiguel robertomonteromiguel left a comment

Choose a reason for hiding this comment

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

There are tests failures. Could you check if are related with your PR before merge?

@mhlidd
Copy link
Contributor Author

mhlidd commented Dec 13, 2024

There are tests failures. Could you check if are related with your PR before merge?

The .NET parametric scenarios are unrelated (seem to be caused by this PR). I don't believe the python weblog is related either...?

)

def test_ip_headers_sent_in_one_request(self):
trace = [span for _, _, span in interfaces.library.get_spans(self.req, full_trace=True)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

The array is a lit if spans if I'm not wrong

Suggested change
trace = [span for _, _, span in interfaces.library.get_spans(self.req, full_trace=True)]
spans = [span for _, _, span in interfaces.library.get_spans(self.req, full_trace=True)]
Suggested change
trace = [span for _, _, span in interfaces.library.get_spans(self.req, full_trace=True)]
trace = [span for _, _, span in interfaces.library.get_spans(self.req, full_trace=True)]


def test_ip_headers_sent_in_one_request(self):
trace = [span for _, _, span in interfaces.library.get_spans(self.req, full_trace=True)]
print(trace)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
print(trace)
logger.info(spans)

weblog_env={
"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false",
"DD_TRACE_CLIENT_IP_HEADER": "custom-ip-header",
# disable ASM to test non asm client ip tagging
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a appsec_enabled argument to EndToEndScenario, you can set it to False

Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

Failures are not related

@mhlidd mhlidd merged commit 8b85e46 into main Dec 13, 2024
432 of 434 checks passed
@mhlidd mhlidd deleted the mhlidd/trace_client_ip branch December 13, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants