Repository: DataDog/dd-trace-py

Issue:
Disable datadog tracer library logs
<!--
Thanks for taking the time for reporting an issue!

Before reporting an issue on dd-trace-py, please be sure to provide all
necessary information.

If you're hitting a bug, make sure that you're using the latest version of this
library.
-->

### Summary of problem

Apologies if this is not the place to ask for help. Our application log is flooded with error messages from datadog. Please see below. Setting aside the error messges themselves is there a way to completely disable all the logs from datadog library?

```
Traceback (most recent call last):
  File "/usr/src/app/.venv/lib/python3.9/site-packages/ddtrace/internal/remoteconfig/client.py", line 407, in request
    response = self._send_request(payload)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/ddtrace/internal/remoteconfig/client.py", line 248, in _send_request
    self._conn.request("POST", "v0.7/config", payload, self._headers)
  File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/usr/local/lib/python3.9/http/client.py", line 946, in connect
    self.sock = self._create_connection(
  File "/usr/local/lib/python3.9/socket.py", line 844, in create_connection
    raise err
  File "/usr/local/lib/python3.9/socket.py", line 832, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address
```

### Which version of dd-trace-py are you using?
1.7.0

### Which version of pip are you using?


### Which libraries and their versions are you using?

<details>
  <summary>`pip freeze`</summary>
  <!-- Paste output of pip freeze here -->
</details>

### How can we reproduce your problem?

### What is the result that you get?

### What is the result that you expected?



Discussion:

Resolving patch:
diff --git a/ddtrace/internal/remoteconfig/client.py b/ddtrace/internal/remoteconfig/client.py
--- a/ddtrace/internal/remoteconfig/client.py
+++ b/ddtrace/internal/remoteconfig/client.py
@@ -2,7 +2,6 @@
 from datetime import datetime
 import hashlib
 import json
-import logging
 import re
 import sys
 from typing import Any
@@ -21,6 +20,7 @@
 from ddtrace.appsec.utils import _appsec_rc_capabilities
 from ddtrace.internal import agent
 from ddtrace.internal import runtime
+from ddtrace.internal.logger import get_logger
 from ddtrace.internal.remoteconfig.constants import REMOTE_CONFIG_AGENT_ENDPOINT
 from ddtrace.internal.runtime import container
 from ddtrace.internal.utils.time import parse_isoformat
@@ -36,7 +36,7 @@
     ProductCallback = Callable[[Optional["ConfigMetadata"], Union[Mapping[str, Any], bool, None]], None]
 
 
-log = logging.getLogger(__name__)
+log = get_logger(__name__)
 
 TARGET_FORMAT = re.compile(r"^(datadog/\d+|employee)/([^/]+)/([^/]+)/([^/]+)$")
 
@@ -271,6 +271,9 @@ def _send_request(self, payload):
             self._conn.request("POST", REMOTE_CONFIG_AGENT_ENDPOINT, payload, self._headers)
             resp = self._conn.getresponse()
             data = resp.read()
+        except OSError as e:
+            log.warning("Unexpected connection error in remote config client request: %s", str(e))  # noqa: G200
+            return None
         finally:
             self._conn.close()
 


Test patch: