Skip to content

Fix AttributeError when telemetry is disabled (#176)#177

Merged
ArnavAgrawal03 merged 1 commit into
morphik-org:mainfrom
non-cpu:fix/176-telemetry-attributeerror
Jun 3, 2025
Merged

Fix AttributeError when telemetry is disabled (#176)#177
ArnavAgrawal03 merged 1 commit into
morphik-org:mainfrom
non-cpu:fix/176-telemetry-attributeerror

Conversation

@non-cpu

@non-cpu non-cpu commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

Summary

Fixes #176

This PR ensures that metadata extractors are initialized even when telemetry is disabled. Previously, the _initialize() method returned early before setting up ingest_file_metadata and other attributes, leading to AttributeError.

Changes

  • Moved _setup_metadata_extractors() to run unconditionally before the TELEMETRY_ENABLED check.

Testing

  • Verified that the application runs correctly with both telemetry enabled and disabled.
  • Confirmed that AttributeError no longer occurs when telemetry is disabled.

Let me know if you'd like any changes!

@jazzberry-ai

jazzberry-ai Bot commented Jun 1, 2025

Copy link
Copy Markdown

Bug Report

Name: AttributeError when telemetry is disabled
Severity: High
Example test case: Set TELEMETRY_ENABLED to False in core/config.py. Then, attempt to use any function that relies on the telemetry service.
Description: The method _setup_metadata_extractors is called unconditionally in TelemetryService._initialize, even when TELEMETRY_ENABLED is False. This method initializes self.metadata_extractors. However, the TelemetryService is only instantiated when TELEMETRY_ENABLED is True. Thus, when TELEMETRY_ENABLED is False, self is not initialized and does not have the attribute metadata_extractors. This will lead to an AttributeError when _setup_metadata_extractors is called.

Comments? Email us.

@CLAassistant

CLAassistant commented Jun 1, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ArnavAgrawal03 ArnavAgrawal03 merged commit e549c7a into morphik-org:main Jun 3, 2025
2 checks passed
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.

AttributeError when telemetry is disabled

3 participants