Skip to content

Commit

Permalink
fix: rename tracking log event emitted config
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Nov 7, 2023
1 parent a414e11 commit da73352
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions eventtracking/backends/event_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from openedx_events.event_bus import get_producer

from eventtracking.backends.routing import RoutingBackend
from eventtracking.config import SEND_TRACKING_EVENT_EMITTED_SIGNAL
from eventtracking.config import SEND_TRACKING_LOG_EVENT_EMITTED_SIGNAL

logger = logging.getLogger(__name__)

Expand All @@ -23,7 +23,7 @@ def send(self, event):
Send the tracking log event to the event bus by emitting the
TRACKING_LOG_EVENT_EMITTED signal using custom metadata.
"""
if not SEND_TRACKING_EVENT_EMITTED_SIGNAL.is_enabled():
if not SEND_TRACKING_LOG_EVENT_EMITTED_SIGNAL.is_enabled():
return

data = json.dumps(event.get("data"))
Expand Down
6 changes: 3 additions & 3 deletions eventtracking/backends/tests/test_event_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from django.test import override_settings
from openedx_events.analytics.data import TrackingLogData
from openedx_events.analytics.signals import TRACKING_EVENT_EMITTED
from openedx_events.analytics.signals import TRACKING_LOG_EVENT_EMITTED

from eventtracking.backends.event_bus import EventBusRoutingBackend

Expand Down Expand Up @@ -46,7 +46,7 @@ def test_successful_send_event(self, mock_get_producer):
mock_send.assert_called()
self.assertDictContainsSubset(
{
"signal": TRACKING_EVENT_EMITTED,
"signal": TRACKING_LOG_EVENT_EMITTED,
"topic": "analytics",
"event_key_field": "tracking_log.name",
"event_data": {
Expand All @@ -64,7 +64,7 @@ def test_successful_send_event(self, mock_get_producer):
)

@patch(
"eventtracking.backends.event_bus.SEND_TRACKING_EVENT_EMITTED_SIGNAL.is_enabled"
"eventtracking.backends.event_bus.SEND_TRACKING_LOG_EVENT_EMITTED_SIGNAL.is_enabled"
)
@patch("eventtracking.backends.event_bus.get_producer")
def test_event_is_disabled(self, mock_get_producer, mock_is_enabled):
Expand Down
10 changes: 5 additions & 5 deletions eventtracking/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

from edx_toggles.toggles import SettingToggle

# .. toggle_name: SEND_TRACKING_EVENT_EMITTED_SIGNAL
# .. toggle_name: SEND_TRACKING_LOG_EVENT_EMITTED_SIGNAL
# .. toggle_implementation: SettingToggle
# .. toggle_default: False
# .. toggle_description: When True, the system will publish `TRACKING_EVENT_EMITTED` signals to the event bus. The
# `TRACKING_EVENT_EMITTED` signal is emit when a tracking log is emitted.
# .. toggle_description: When True, the system will publish `TRACKING_LOG_EVENT_EMITTED` signals to the event bus. The
# `TRACKING_LOG_EVENT_EMITTED` signal is emit when a tracking log is emitted.
# .. toggle_use_cases: circuit_breaker
# .. toggle_creation_date: 2023-10-26
SEND_TRACKING_EVENT_EMITTED_SIGNAL = SettingToggle(
'SEND_TRACKING_EVENT_EMITTED_SIGNAL',
SEND_TRACKING_LOG_EVENT_EMITTED_SIGNAL = SettingToggle(
'SEND_TRACKING_LOG_EVENT_EMITTED_SIGNAL',
default=True,
module_name=__name__
)

0 comments on commit da73352

Please sign in to comment.