Emisar Product Analytics
This notebook pack reports product, revenue, reliability, and security facts from the production PostgreSQL mirror. Every query is aggregate or bounded, runs through an IAM-authenticated local proxy, defaults to read-only, and has a 30-second statement timeout.
Dashboards
- Executive overview
- Growth and activation
- Revenue
- Engagement and retention
- Runs and reliability
- MCP agents and client families
- Security and approvals
- Account health
- Metric definitions and data quality
Setup
Mix.install([
{:postgrex, "~> 0.22.0"},
{:kino, "~> 0.19.0"},
{:kino_vega_lite, "~> 0.1.13"}
])
Code.require_file("/opt/emisar/product_analytics.exs")
alias EmisarProductAnalytics, as: Analytics
db = Analytics.connect!()
Data freshness
freshness =
Analytics.query(db, """
SELECT 'accounts' AS dataset, max(inserted_at) AS latest_record FROM accounts
UNION ALL
SELECT 'action_runs', max(inserted_at) FROM action_runs
UNION ALL
SELECT 'audit_events', max(inserted_at) FROM audit_events
UNION ALL
SELECT 'subscriptions', max(updated_at) FROM subscriptions
ORDER BY dataset
""")
Analytics.table(freshness)