Skip to content

Commit

Permalink
Log warning if import of snowplow_tracker fails
Browse files Browse the repository at this point in the history
Closes issue meltano#8256

It may be a temporary woraround -
it may be removed once dbt-labs/dbt-core#8680 is merged.
  • Loading branch information
jaceksan committed Dec 5, 2023
1 parent b8c199a commit 09cd1c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/meltano/core/tracking/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import structlog
import tzlocal
from psutil import Process
from snowplow_tracker import Emitter, SelfDescribing, SelfDescribingJson
from snowplow_tracker import Tracker as SnowplowTracker

from meltano.core.project import Project
from meltano.core.tracking.schemas import (
Expand Down Expand Up @@ -49,6 +47,18 @@

logger = structlog.get_logger(__name__)

# Supress these imports from snowplow_tracker if tracking is disabled
# It helps to resolve issues related to import conflicts -
# snowplow-tracker vs. minimal-snowplow tracker
try:
from snowplow_tracker import Emitter, SelfDescribing, SelfDescribingJson
from snowplow_tracker import Tracker as SnowplowTracker
except Exception as e:
logger.warning(
"Import of snowplow_tracker failed. "
f"Disable tracking to fix it. Reason: {str(e)}",
)


class BlockEvents(Enum):
"""Events describing a block state."""
Expand Down

0 comments on commit 09cd1c2

Please sign in to comment.