Skip to content

Commit

Permalink
Cut down on the amount of INFO-level logging (elastic#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbaamonde authored Nov 8, 2022
1 parent 445f2a0 commit 847b9b3
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 64 deletions.
10 changes: 5 additions & 5 deletions esrally/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def actorSystemCapabilityCheck(capabilities, requirements):
current = capabilities.get(name, None)
if current != value:
# A mismatch by is not a problem by itself as long as at least one actor system instance matches the requirements.
logger.info("Checking capabilities [%s] against requirements [%s] failed.", capabilities, requirements)
logger.debug("Checking capabilities [%s] against requirements [%s] failed.", capabilities, requirements)
return False
logger.info("Capabilities [%s] match requirements [%s].", capabilities, requirements)
logger.debug("Capabilities [%s] match requirements [%s].", capabilities, requirements)
return True

def transition_when_all_children_responded(self, sender, msg, expected_status, new_status, transition):
Expand Down Expand Up @@ -176,7 +176,7 @@ def send_to_children_and_transition(self, sender, msg, expected_status, new_stat
:param new_status: The new status.
"""
if self.is_current_status_expected(expected_status):
self.logger.info("Transitioning from [%s] to [%s].", self.status, new_status)
self.logger.debug("Transitioning from [%s] to [%s].", self.status, new_status)
self.status = new_status
for m in filter(None, self.children):
self.send(m, msg)
Expand Down Expand Up @@ -225,10 +225,10 @@ def bootstrap_actor_system(try_join=False, prefer_local_only=False, local_ip=Non
try:
if try_join:
if actor_system_already_running():
logger.info("Joining already running actor system with system base [%s].", system_base)
logger.debug("Joining already running actor system with system base [%s].", system_base)
return thespian.actors.ActorSystem(system_base)
else:
logger.info("Creating new actor system with system base [%s] on coordinator node.", system_base)
logger.debug("Creating new actor system with system base [%s] on coordinator node.", system_base)
# if we try to join we can only run on the coordinator...
return thespian.actors.ActorSystem(system_base, logDefs=log.load_configuration(), capabilities={"coordinator": True})
elif prefer_local_only:
Expand Down
27 changes: 13 additions & 14 deletions esrally/client/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def __init__(self, hosts, client_options):
# pylint: disable=import-outside-toplevel
import ssl

self.logger.info("SSL support: on")
self.logger.debug("SSL support: on")
self.client_options["scheme"] = "https"

self.ssl_context = ssl.create_default_context(
ssl.Purpose.SERVER_AUTH, cafile=self.client_options.pop("ca_certs", certifi.where())
)

if not self.client_options.pop("verify_certs", True):
self.logger.info("SSL certificate verification: off")
self.logger.debug("SSL certificate verification: off")
# order matters to avoid ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED
self.ssl_context.check_hostname = False
self.ssl_context.verify_mode = ssl.CERT_NONE
Expand All @@ -74,14 +74,14 @@ def __init__(self, hosts, client_options):
# check_hostname should not be set when host is an IP address
self.ssl_context.check_hostname = self._only_hostnames(hosts)
self.ssl_context.verify_mode = ssl.CERT_REQUIRED
self.logger.info("SSL certificate verification: on")
self.logger.debug("SSL certificate verification: on")

# When using SSL_context, all SSL related kwargs in client options get ignored
client_cert = self.client_options.pop("client_cert", False)
client_key = self.client_options.pop("client_key", False)

if not client_cert and not client_key:
self.logger.info("SSL client authentication: off")
self.logger.debug("SSL client authentication: off")
elif bool(client_cert) != bool(client_key):
self.logger.error("Supplied client-options contain only one of client_cert/client_key. ")
defined_client_ssl_option = "client_key" if client_key else "client_cert"
Expand All @@ -101,10 +101,10 @@ def __init__(self, hosts, client_options):
)
)
elif client_cert and client_key:
self.logger.info("SSL client authentication: on")
self.logger.debug("SSL client authentication: on")
self.ssl_context.load_cert_chain(certfile=client_cert, keyfile=client_key)
else:
self.logger.info("SSL support: off")
self.logger.debug("SSL support: off")
self.client_options["scheme"] = "http"

if self._is_set(self.client_options, "create_api_key_per_client"):
Expand All @@ -126,24 +126,24 @@ def __init__(self, hosts, client_options):
"to 'create_api_key_per_client' in order to create client API keys."
)
)
self.logger.info("Automatic creation of client API keys: on")
self.logger.debug("Automatic creation of client API keys: on")
else:
self.logger.info("Automatic creation of client API keys: off")
self.logger.debug("Automatic creation of client API keys: off")

if self._is_set(self.client_options, "basic_auth_user") and self._is_set(self.client_options, "basic_auth_password"):
self.logger.info("HTTP basic authentication: on")
self.logger.debug("HTTP basic authentication: on")
self.client_options["http_auth"] = (self.client_options.pop("basic_auth_user"), self.client_options.pop("basic_auth_password"))
else:
self.logger.info("HTTP basic authentication: off")
self.logger.debug("HTTP basic authentication: off")

if self._is_set(self.client_options, "compressed"):
console.warn("You set the deprecated client option 'compressed‘. Please use 'http_compress' instead.", logger=self.logger)
self.client_options["http_compress"] = self.client_options.pop("compressed")

if self._is_set(self.client_options, "http_compress"):
self.logger.info("HTTP compression: on")
self.logger.debug("HTTP compression: on")
else:
self.logger.info("HTTP compression: off")
self.logger.debug("HTTP compression: off")

if self._is_set(self.client_options, "enable_cleanup_closed"):
self.client_options["enable_cleanup_closed"] = convert.to_bool(self.client_options.pop("enable_cleanup_closed"))
Expand Down Expand Up @@ -240,15 +240,14 @@ def wait_for_rest_layer(es, max_attempts=40):
expected_node_count = len(es.transport.hosts)
logger = logging.getLogger(__name__)
for attempt in range(max_attempts):
logger.debug("REST API is available after %s attempts", attempt)
# pylint: disable=import-outside-toplevel
import elasticsearch

try:
# see also WaitForHttpResource in Elasticsearch tests. Contrary to the ES tests we consider the API also
# available when the cluster status is RED (as long as all required nodes are present)
es.cluster.health(wait_for_nodes=">={}".format(expected_node_count))
logger.info("REST API is available for >= [%s] nodes after [%s] attempts.", expected_node_count, attempt)
logger.debug("REST API is available for >= [%s] nodes after [%s] attempts.", expected_node_count, attempt)
return True
except elasticsearch.ConnectionError as e:
if "SSL: UNKNOWN_PROTOCOL" in str(e):
Expand Down
Loading

0 comments on commit 847b9b3

Please sign in to comment.