Skip to content

Commit

Permalink
fix: only generate metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 26, 2023
1 parent 9c56b7b commit b05d73f
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions eventtracking/backends/event_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

logger = logging.getLogger(__name__)

EVENT_BUS_SOURCE = "openedx/eventtracking"

class EventBusRoutingBackend(RoutingBackend):
"""
Event tracker backend that emits an Open edX public signal.
Expand All @@ -38,22 +36,13 @@ def send(self, event):
context=context,
)

metadata = TRACKING_EVENT_EMITTED.generate_signal_metadata()

logger.info(f"Sending tracking event emitted signal for event for {tracking_log.name}")
get_producer().send(
signal=TRACKING_EVENT_EMITTED,
topic="analytics",
event_key_field="tracking_log.name",
event_data={"tracking_log": tracking_log},
event_metadata=generate_signal_metadata()
event_metadata=metadata,
)


def generate_signal_metadata():
"""
Generate the metadata for the signal with a custom source.
"""
metadata = TRACKING_EVENT_EMITTED.generate_signal_metadata()
medata_dict = asdict(metadata)
medata_dict["source"] = EVENT_BUS_SOURCE
metadata = EventsMetadata(**medata_dict)
return metadata

0 comments on commit b05d73f

Please sign in to comment.