Session Activity
SessionActivityComponent reports when Cookie Monster last recorded OMS session activity for each
dealer. Ordering runs and data collection jobs need a usable OMS session. The component therefore
marks a dealer with no recent activity as needing a login reminder.
Assets
| Asset | One row per |
|---|---|
<oem>/<market>/raw/session_activity | user |
<oem>/<market>/reporting/dealer_session_activity | dealer |
Each asset has one partition per day. The raw asset runs on cron_schedule.
dealer_session_activity runs after the raw asset writes a partition. It ignores updates to
consolidated/dealers, so each asset runs once a day for each OEM. Each asset's freshness
policy expects at least one materialization in the day before each cron_schedule tick.
The raw asset reads the OEM's Cookie Monster collection in the ppm-userinfo database. The query
returns only userId, dealerId, lastSeen and the user fields listed in user_fields. It
skips a record whose userId is not a string or whose lastSeen is not a date.
Latest activity
A user's latest activity is lastSeen. Cookie Monster updates it on every extension ping and on
every successful scheduled refresh. days_since_activity is the number of days from the date of
lastSeen (UTC) to the partition date.
A dealer's latest activity is the most recent lastSeen among its users. The dealer's users
column lists each user with their own days_since_activity.
Login reminder
A dealer's needs_login_reminder column is true when its days_since_activity is at least
min_days_since_activity and below max_days_since_activity. For a dealer at or past the maximum,
the column is false. Such a dealer has likely stopped using the browser extension.
Dealer codes
dealer_session_activity matches each dealerId to a consolidated dealer on dealer_code. It
leaves out a dealerId with no consolidated dealer. The unknown_dealer_codes check lists each
such dealerId. It also leaves out a user with no dealerId, and the check's
missing_dealer_code_count counts those users. The check has WARN severity and is not blocking.
The has_user_records check on dealer_session_activity fails when the raw partition has no user
records, for example because collection names the wrong collection. Without it, an empty read would
look like a day when no dealer needs a reminder. The check also has WARN severity.
Slack
dealer_session_activity posts to Slack after it writes its table and reports its checks, so a Slack
failure cannot stop the table from being written. It posts only for today's partition (UTC), and
never on a branch deployment. A run for an earlier partition, such as a backfill, writes the table
and posts nothing.
The asset posts nothing when no dealer needs a reminder. Otherwise it posts one message to
slack_channel with the number of dealers that need a reminder. The message also lists
those dealers when there are at most list_dealers_up_to of them. Each dealer then gets one reply
in the message's thread, with its latest activity and each user's name, email and days since
activity. The replies are posted one second apart, which keeps them within Slack's rate limit for
one channel.
After it posts the message and before it posts the first reply, the asset records the message's
slack_ts in an asset observation of the partition. A later run of the same partition finds that
observation and posts nothing. If a thread reply fails, the run fails and the thread stays
incomplete. Post the missing replies by hand if they are needed.
Each OEM's slack_channel comes from the slack_channel template variable in its
template_vars.py.
Past partitions
The collection keeps only each user's current record. A past partition therefore cannot be recomputed. The raw asset writes a partition only when it runs on the partition's date in UTC. A run for an earlier partition fails.
Configuration
type: ai_dagster.components.SessionActivityComponent
template_vars_module: ai_audi.defs.audi.us.template_vars
attributes:
start_date: "2026-10-19"
collection: audi_user_info
cron_schedule: "0 9 * * *"
cron_timezone: America/New_York
login_reminder:
min_days_since_activity: 7
max_days_since_activity: 30
user_fields:
email: email
slack_channel: "{{ slack_channel }}"
label: Audi US
list_dealers_up_to: 10
user has a different schema per OEM, so user_fields gives the path of each field in dot
notation. email is required and becomes the column user_email. name is an optional list of
paths, and their values joined with a space become the column user_name. user can contain private
information, so the raw asset reads no other user field.