Skip to content

Commit

Permalink
chore(telemetry): Change logging level to DEBUG for most messages (#…
Browse files Browse the repository at this point in the history
…823)

* Change logging level to debug

Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>

* Tests

Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>

* Add back message tests

Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>

* Change logging level for pytest

Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>

---------

Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
  • Loading branch information
ankatiyar committed Sep 5, 2024
1 parent cf1617b commit 5e8787a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kedro-telemetry/kedro_telemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import logging

logging.getLogger(__name__).setLevel(logging.INFO)
logging.getLogger(__name__).setLevel(logging.DEBUG)
16 changes: 9 additions & 7 deletions kedro-telemetry/kedro_telemetry/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _get_or_create_uuid() -> str:
return new_uuid

except Exception as e:
logging.error(f"Failed to retrieve UUID: {e}")
logging.debug(f"Failed to retrieve UUID: {e}")
return ""


Expand All @@ -104,7 +104,7 @@ def _get_or_create_project_id(pyproject_path: Path) -> str | None:
file.write(toml_string)
return project_id
except KeyError:
logging.error(
logging.debug(
f"Failed to retrieve project id or save project id: "
f"{str(pyproject_path)} does not contain a [tool.kedro] section"
)
Expand Down Expand Up @@ -148,7 +148,7 @@ def _generate_new_uuid(full_path: str) -> str:

return new_uuid
except Exception as e:
logging.error(f"Failed to create UUID: {e}")
logging.debug(f"Failed to create UUID: {e}")
return ""


Expand Down Expand Up @@ -200,13 +200,15 @@ def after_command_run(self):

@hook_impl
def after_context_created(self, context):
"""Hook implementation to send project statistics data to Heap"""
"""Hook implementation to read metadata"""

self._consent = _check_for_telemetry_consent(context.project_path)
self._project_path = context.project_path

@hook_impl
def after_catalog_created(self, catalog):
"""Hook implementation to send project statistics data to Heap"""

if self._consent is False:
return

Expand Down Expand Up @@ -246,7 +248,7 @@ def _send_telemetry_heap_event(self, event_name: str):
)
self._sent = True
except Exception as exc:
logger.warning(
logger.debug(
"Something went wrong in hook implementation to send command run data to Heap. "
"Exception: %s",
exc,
Expand Down Expand Up @@ -333,13 +335,13 @@ def _send_heap_event(
url=HEAP_ENDPOINT, headers=HEAP_HEADERS, data=json.dumps(data), timeout=10
)
if resp.status_code != 200: # noqa: PLR2004
logger.warning(
logger.debug(
"Failed to send data to Heap. Response code returned: %s, Response reason: %s",
resp.status_code,
resp.reason,
)
except requests.exceptions.RequestException as exc:
logger.warning(
logger.debug(
"Failed to send data to Heap. Exception of type '%s' was raised.",
type(exc).__name__,
)
Expand Down

0 comments on commit 5e8787a

Please sign in to comment.