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

Allow suppresing error logs for Core::Remote::Negotiation #3495

Merged

Conversation

anmarchenko
Copy link
Contributor

@anmarchenko anmarchenko commented Feb 29, 2024

What does this PR do?
Adds suppress_logging keyword argument that makes it possible to skip logging error messages for selected error cases.

Usage:

negotiation = Datadog::Core::Remote::Negotiation.new(
  settings, 
  agent_settings, 
  suppress_logging: { no_config_endpoint: true }
)

# no error logged
negotiation.endpoint?("/evp_proxy/v4/") # => false

Motivation:
datadog-ci gem uses Datadog::Core::Remote::Negotiation to check if agent has certain endpoints available(/evp_proxy/v4 and /evp_proxy/v2/) to configure the correct transport for citestcycle events. We do not treat the absence of any of these endpoints as error, just an information for us to choose the correct way to send events.

Currently, this class treats this situation as an error and logs error message thus creating unnecessary noise for the user. This PR aims to fix it by allowing us to skip certain logs.

How to test the change?
Covered by unit tests; default behaviour didn't change.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

@anmarchenko anmarchenko requested a review from a team as a code owner February 29, 2024 12:54
@github-actions github-actions bot added the core Involves Datadog core libraries label Feb 29, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.23%. Comparing base (12bfc2f) to head (387bfd2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3495   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files        1275     1275           
  Lines       75176    75182    +6     
  Branches     3551     3551           
=======================================
+ Hits        73851    73858    +7     
+ Misses       1325     1324    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anmarchenko anmarchenko merged commit f1f69d9 into master Mar 1, 2024
220 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/core_remote_negotiation_suppress_logging branch March 1, 2024 07:52
@github-actions github-actions bot added this to the 2.0 milestone Mar 1, 2024
@ivoanjo ivoanjo modified the milestones: 2.0, 1.21.0 Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants