-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add signal for event-tracking emission (#230)
- Loading branch information
Showing
6 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
more information about the project. | ||
""" | ||
|
||
__version__ = "9.0.1" | ||
__version__ = "9.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
Package where events related to the analytics subdomain are implemented. | ||
The analytics subdomain corresponds to {Architecture Subdomain} defined in | ||
the OEP-41. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Data attributes for events within the architecture subdomain ``analytics``. | ||
These attributes follow the form of attr objects specified in OEP-49 data | ||
pattern. | ||
""" | ||
|
||
from datetime import datetime | ||
|
||
import attr | ||
|
||
|
||
@attr.s(frozen=True) | ||
class TrackingLogData: | ||
""" | ||
Data describing tracking events. | ||
Arguments: | ||
name (str): event name | ||
timestamp (datetime): timestamp of the event | ||
data (str): json string representation of a dictionary with extra data (optional), | ||
e.g. {"course_id": "course-v1:edX+DemoX+Demo_Course"} | ||
context (dict): json string representation of a dictionary of context data | ||
defined in https://edx.readthedocs.io/projects/devdata/en/latest/internal_data_formats/tracking_logs/ | ||
""" | ||
|
||
name = attr.ib(type=str) | ||
timestamp = attr.ib(type=datetime) | ||
data = attr.ib(type=str) | ||
context = attr.ib(type=str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Standardized signals definitions for events within the architecture subdomain ``analytics``. | ||
All signals defined in this module must follow the name and versioning | ||
conventions specified in OEP-41. | ||
They also must comply with the payload definition specified in | ||
docs/decisions/0003-events-payload.rst | ||
""" | ||
|
||
from openedx_events.analytics.data import TrackingLogData | ||
from openedx_events.tooling import OpenEdxPublicSignal | ||
|
||
# .. event_type: org.openedx.analytics.tracking.event.emitted.v1 | ||
# .. event_name: TRACKING_EVENT_EMITTED | ||
# .. event_description: emitted when a tracking log is created. | ||
# .. event_data: TrackingLogData | ||
TRACKING_EVENT_EMITTED = OpenEdxPublicSignal( | ||
event_type="org.openedx.analytics.tracking.event.emitted.v1", | ||
data={ | ||
"tracking_log": TrackingLogData, | ||
} | ||
) |
33 changes: 33 additions & 0 deletions
33
.../event_bus/avro/tests/schemas/org+openedx+analytics+tracking+event+emitted+v1_schema.avsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "CloudEvent", | ||
"type": "record", | ||
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema", | ||
"fields": [ | ||
{ | ||
"name": "tracking_log", | ||
"type": { | ||
"name": "TrackingLogData", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "name", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "timestamp", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "data", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "context", | ||
"type": "string" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"namespace": "org.openedx.analytics.tracking.event.emitted.v1" | ||
} |