Skip to content

removed useless debug logging#1133

Merged
phenobarbital merged 1 commit into
masterfrom
refactor-2.7-scylladb
Jun 8, 2024
Merged

removed useless debug logging#1133
phenobarbital merged 1 commit into
masterfrom
refactor-2.7-scylladb

Conversation

@phenobarbital
Copy link
Copy Markdown
Owner

@phenobarbital phenobarbital commented Jun 8, 2024

Summary by Sourcery

This pull request removes unnecessary debug logging statements from various driver files, including PostgreSQL, RethinkDB, Memcache, Cassandra, and Redis. Additionally, it updates the version number of the asyncdb library from 2.7.10 to 2.7.11.

  • Enhancements:
    • Removed unnecessary debug logging statements from multiple driver files to clean up the codebase.

@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Jun 8, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
4204158 Triggered Generic High Entropy Secret 8add907 examples/test_influx.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@phenobarbital phenobarbital merged commit c3b9534 into master Jun 8, 2024
@phenobarbital phenobarbital deleted the refactor-2.7-scylladb branch June 8, 2024 16:56
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 8, 2024

Reviewer's Guide by Sourcery

This pull request focuses on removing unnecessary debug logging statements from various files in the asyncdb project. The changes are implemented by commenting out or deleting the debug log lines, which helps in cleaning up the code and potentially improving performance by reducing logging overhead.

File-Level Changes

Files Changes
asyncdb/drivers/pg.py
asyncdb/drivers/rethink.py
asyncdb/drivers/memcache.py
asyncdb/drivers/cassandra.py
asyncdb/drivers/redis.py
Removed unnecessary debug logging statements from various driver files.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @phenobarbital - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 6 issues found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment thread asyncdb/drivers/pg.py
Creates a Pool Connection.
"""
self._logger.debug(f"AsyncPg (Pool): Connecting to {self._dsn}")
# self._logger.debug(f"AsyncPg (Pool): Connecting to {self._dsn}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Commented out debug logging

The debug logging for the connection has been commented out. If this is intentional for production, consider adding a conditional debug flag to enable it when needed.

Suggested change
# self._logger.debug(f"AsyncPg (Pool): Connecting to {self._dsn}")
if self._debug:
self._logger.debug(f"AsyncPg (Pool): Connecting to {self._dsn}")

Comment thread asyncdb/drivers/pg.py
except (ValueError, RuntimeError) as err:
self._logger.warning(f"Error on Init Connection: {err}")
self._initialized_on = time.time()
self._logger.debug(f"Initialized on: {self._initialized_on}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Removed debug logging for initialization

The debug logging for initialization has been removed. If this was useful for debugging purposes, consider adding a conditional debug flag to enable it when needed.

Suggested change
self._logger.debug(f"Initialized on: {self._initialized_on}")
except (ValueError, RuntimeError) as err:
self._logger.warning(f"Error on Init Connection: {err}")
self._initialized_on = time.time()
if self._debug:
self._logger.debug(f"Initialized on: {self._initialized_on}")
return self
except ConnectionRefusedError as err:

Comment on lines -116 to -118
self._logger.debug(
f'RT Connection to host {self.params["host"]}:{self.params["port"]}'
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Removed debug logging for RethinkDB connection

The debug logging for the RethinkDB connection has been removed. If this was useful for monitoring connections, consider adding a conditional debug flag to enable it when needed.

Suggested change
self._logger.debug(
f'RT Connection to host {self.params["host"]}:{self.params["port"]}'
)
if self.params.get("debug", False):
self._logger.debug(
f'RT Connection to host {self.params["host"]}:{self.params["port"]}'
)

Comment thread examples/test_influx.py
"user": "troc_pgdata",
"password": "12345678",
"org": "navigator",
"bucket": "navigator",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 issue (security): Removed sensitive token

The token has been removed from the parameters. Ensure that this change does not affect the functionality of the test and that the token is securely managed elsewhere.

return params

async def connect(self):
self._logger.debug(f"Memcache: Connecting to {self._params}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Removed debug logging for Memcache connection

The debug logging for the Memcache connection has been removed. If this was useful for debugging purposes, consider adding a conditional debug flag to enable it when needed.

Suggested change
self._logger.debug(f"Memcache: Connecting to {self._params}")
return params
async def connect(self, debug=False):
if debug:
self._logger.debug(f"Memcache: Connecting to {self._params}")
try:
self._pool = aiomcache.Client(pool_size=self._max_queries, **self._params)

execution_profiles=profiles,
**params,
)
print(self._cluster)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Removed print statement

The print statement for the cluster has been removed. Ensure that this information is logged appropriately if needed for debugging or monitoring.

Suggested change
print(self._cluster)
import logging
logger = logging.getLogger(__name__)
logger.debug(f"Cluster: {self._cluster}")

Comment thread asyncdb/drivers/redis.py
"""
__init async db initialization
"""
self._logger.debug(f"Redis Pool: Connecting to {self._dsn}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Removed debug logging for Redis connection

The debug logging for the Redis connection has been removed. If this was useful for debugging purposes, consider adding a conditional debug flag to enable it when needed.

Suggested change
self._logger.debug(f"Redis Pool: Connecting to {self._dsn}")
if self._debug:
self._logger.debug(f"Redis Pool: Connecting to {self._dsn}")

phenobarbital added a commit that referenced this pull request Mar 20, 2026
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.

1 participant