Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_active_by_product_term_monthly",
"reportType": "TIMELINE",
"reportPrettyName": "Monthly active subscriptions",
"reportPrettyName": "Monthly Active Subscriptions by Product Term",
"sourceTableName": "report_active_by_product_term_monthly",
"refreshProcedureName": "refresh_active_by_product_term_monthly",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```
## Report UI:

![monthly-active-subs-by-product-term.png](monthly-active-subs-by-product-term.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,7 @@ DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_active_by_product_term_monthly;
insert into report_active_by_product_term_monthly
select
x.tenant_record_id
, cal.d day
, x.product_name
, x.billing_period
, x.count
from calendar cal
join (
select
tenant_record_id
, last_day(day) day
, product_name
, billing_period
, count
from
v_report_active_by_product_term_monthly
where 1=1
) x on last_day(cal.d) = x.day
where 1=1
;
insert into report_active_by_product_term_monthly select * from v_report_active_by_product_term_monthly;
COMMIT;

END;
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/reports/cancellations_daily/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_cancellations_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily cancellations",
"reportPrettyName": "Daily Cancellations",
"sourceTableName": "report_cancellations_daily",
"refreshProcedureName": "refresh_report_cancellations_daily",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```
## Report UI:

![daily-cancellations.png](daily-cancellations.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Conversions Total Dollar Amount Report

Compute (monthly) the total revenue from subscriptions converting out of trial, grouped by tenant and billing period.

The snapshot view is: `v_report_conversions_total_dollar_monthly`

## Timeline configuration

```
curl -v \
-X POST \
-u admin:password \
-H "X-Killbill-ApiKey:bob" \
-H "X-Killbill-ApiSecret:lazar" \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_conversions_total_dollar_monthly",
"reportType": "TIMELINE",
"reportPrettyName": "Conversions Total Dollar Amount",
"sourceTableName": "report_conversions_total_dollar_monthly",
"refreshProcedureName": "refresh_report_conversions_total_dollar_monthly",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Sample Data

|Tenant Record Id|Day |Billing Period| Count|
|--|--|--|--|
|1|2025-06-01 |WEEKLY |30|
|1|2025-07-01 |MONTHLY |30|
|1| 2025-07-01 |QUARTERLY |70|
|6| 2025-01-01 |ANNUAL|200|
|1| 2025-04-01 |MONTHLY|30|

Here day represents the first day of the month representing that subscription's conversion month. So if the subscription converts from TRIAL to EVERGREEN phase on `2025-04-15`, the day will be `2025-04-01`.

## Report UI:

![conversion-total-dollar-amount.png](conversion-total-dollar-amount.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create table report_conversions_total_dollar_monthly as select * from v_report_conversions_total_dollar_monthly limit 0;

drop procedure if exists refresh_report_conversions_total_dollar_monthly;
DELIMITER //
CREATE PROCEDURE refresh_report_conversions_total_dollar_monthly()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_conversions_total_dollar_monthly;
insert into report_conversions_total_dollar_monthly select * from v_report_conversions_total_dollar_monthly;
COMMIT;

END;
//
DELIMITER ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
create or replace view v_report_conversions_total_dollar_monthly as
select
ast.tenant_record_id,
date_format(next_start_date, '%Y-%m-01') day,
next_billing_period billing_period,
round(sum(converted_next_price)) count
from analytics_subscription_transitions ast
join (
select distinct tenant_record_id, bundle_id
from analytics_invoice_items
where invoice_original_amount_charged > 0
and invoice_balance = 0
) paid_bundles
on ast.bundle_id = paid_bundles.bundle_id
and ast.tenant_record_id = paid_bundles.tenant_record_id
where report_group = 'default'
and next_service = 'entitlement-service'
and prev_phase = 'TRIAL'
and next_phase != 'TRIAL'
and event not like 'STOP_ENTITLEMENT%'
group by 1,2,3;

This file was deleted.

This file was deleted.

5 changes: 4 additions & 1 deletion src/main/resources/reports/invoices_balance_daily/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_invoices_balance_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily invoices balance",
"reportPrettyName": "Daily Invoices Balance",
"sourceTableName": "report_invoices_balance_daily",
"refreshProcedureName": "refresh_report_invoices_balance_daily",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```
## Report UI:

![invoice-balance-daily.png](invoice-balance-daily.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/main/resources/reports/invoices_daily/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_invoices_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily invoices value",
"reportPrettyName": "Daily Invoices Value",
"sourceTableName": "report_invoices_daily",
"refreshProcedureName": "refresh_report_invoices_daily",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Report UI:

![invoice-amount-daily.png](invoice-amount-daily.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion src/main/resources/reports/mrr/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Daily MRR

Compute the Monthly Recurring Revenue (MRR) on a daily basis.
Computes the total active MRR (monthly recurring revenue), broken down both by product and as a tenant-wide total (ALL) for each tenant and each day.

The snapshot view is: `v_report_mrr_daily`

Expand All @@ -21,3 +21,18 @@ curl -v \
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Sample Data

| tenant_record_id | product | day | count |
| ---------------- | ------- | ---------- |--------|
| 24 | Pistol | 2025-01-05 | 150.00 |
| 24 | Rifle | 2025-01-05 | 200.00 |
| 24 | ALL | 2025-01-05 | 350.00 |
| 24 | Pistol | 2025-01-06 | 150.00 |
| 24 | ALL | 2025-01-06 | 150.00 |


## Report UI:

![daily-mrr.png](daily-mrr.png)
Binary file added src/main/resources/reports/mrr/daily-mrr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/main/resources/reports/new_accounts_daily/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Daily new accounts report

Compute the total amount of new accounts created per day.
Compute the total amount of new accounts created per day for each tenant.

The snapshot view is: `v_report_new_accounts_daily`

Expand All @@ -15,9 +15,13 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_new_accounts_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily new accounts",
"reportPrettyName": "Daily New Accounts",
"sourceTableName": "report_new_accounts_daily",
"refreshProcedureName": "refresh_report_new_accounts_daily",
"refreshFrequency": "HOURLY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Report UI:

![daily-new-accounts.png](daily-new-accounts.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/main/resources/reports/payments_total_daily/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_payments_total_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily payments value",
"reportPrettyName": "Daily Payments Value",
"sourceTableName": "report_payments_total_daily",
"refreshProcedureName": "refresh_report_payments_total_daily",
"refreshFrequency": "HOURLY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Report UI:

![payments-total-daily.png](payments-total-daily.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
create or replace view v_report_payments_total_daily as
select
tenant_record_id
, day
, currency
, sum(count) as count
from v_report_payments_total_daily_sub1
group by 1,2,3
;
tenant_record_id,
date_format(created_date,'%Y-%m-%d') as day,
currency,
sum(ifnull(converted_amount, 0)) as count
from (
select
ac.tenant_record_id,
ac.created_date,
ac.currency,
ac.converted_amount
from analytics_payment_captures ac
where ac.payment_transaction_status = 'SUCCESS'
and ac.report_group='default'

union all

select
ap.tenant_record_id,
ap.created_date,
ap.currency,
ap.converted_amount
from analytics_payment_purchases ap
where ap.payment_transaction_status = 'SUCCESS'
and ap.report_group='default'
) t
group by 1,2,3;

This file was deleted.

8 changes: 6 additions & 2 deletions src/main/resources/reports/refunds_total_daily/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Daily refunds report

Compute the total value (in the reference currency) of refunds per day per currency.
Compute the total value (in the reference currency) of refunds per day per currency for each tenant.

The snapshot view is: `v_report_refunds_total_daily`

Expand All @@ -15,9 +15,13 @@ curl -v \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_refunds_total_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily refunds value",
"reportPrettyName": "Daily Refunds Value",
"sourceTableName": "report_refunds_total_daily",
"refreshProcedureName": "refresh_report_refunds_total_daily",
"refreshFrequency": "HOURLY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Report UI:

![refunds-total-daily.png](refunds-total-daily.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ select
ar.tenant_record_id
, date_format(ar.created_date,'%Y-%m-%d') as day
, ar.currency as currency
, sum(ar.converted_amount) as count
, sum(abs(ar.converted_invoice_amount_refunded)) as count
from
analytics_payment_refunds ar
where 1=1
Expand Down