Skip to content

Commit 269f01b

Browse files
committed
Aviate 436 - new health apis
1 parent 1bffbb9 commit 269f01b

File tree

1 file changed

+301
-9
lines changed

1 file changed

+301
-9
lines changed

source/includes/_aviate-health.md

Lines changed: 301 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ Represents metric result. It has the following fields:
2929

3030
Represents HealthData. It has the following fields:
3131

32-
| Name | Type | Generated by | Description |
33-
|-------------------------|-----------------------|--------------|---------------------------------------------------------|
34-
| **nodeInfos** | List of NodeInfo | system | Details on all nodes in the Kill Bill cluster. |
35-
| **parkedAccounts** | List of ParkedAccount | system | Parked accounts (limit 50), if any. |
36-
| **lateBusEvents** | List of BusEvent | system | Bus events that need processing (limit 100), if any. |
37-
| **lateNotifications** | List of Notification | system | Notifications that need processing (limit 100), if any. |
38-
| **recentBusEvents** | List of BusEvent | system | Recent bus events that were processed (limit 100). |
39-
| **recentNotifications** | List of Notification | system | Recent notifications that were processed (limit 100). |
40-
| **recentAccessLogs** | List of AccessLog | system | Recent HTTP requests from all nodes (at most 2 days). |
32+
| Name | Type | Generated by | Description |
33+
|-------------------------|-----------------------|--------------|---------------------------------------------------------------|
34+
| **nodeInfos** | List of NodeInfo | system | Details on all nodes in the Kill Bill cluster. |
35+
| **parkedAccounts** | List of ParkedAccount | system | Parked accounts (limit 50), if any. |
36+
| **lateBusEvents** | List of BusEvent | system | Bus events that need processing (limit 100), if any. |
37+
| **lateBusExtEvents** | List of BusEvent | system | External Bus events that need processing (limit 100), if any. |
38+
| **lateNotifications** | List of Notification | system | Notifications that need processing (limit 100), if any. |
39+
| **recentBusEvents** | List of BusEvent | system | Recent bus events that were processed (limit 100). |
40+
| **recentBusExtEvents** | List of BusEvent | system | Recent external bus events that were processed (limit 100). |
41+
| **recentNotifications** | List of Notification | system | Recent notifications that were processed (limit 100). |
42+
| **recentAccessLogs** | List of AccessLog | system | Recent HTTP requests from all nodes (at most 2 days). |
4143

4244
### AccessLog
4345

@@ -442,6 +444,296 @@ If successful, returns a status code of 200 and the requested metric data.
442444
<!-- ### Fix Parked Accounts - This method is not implemented in the code, so not documenting it
443445
-->
444446

447+
### Get Failed Bus Events
448+
449+
Returns a list of failed bus events. Basically returns the records from the `bus_events_history` table that have `processing_state` as `FAILED`. Returns records for the specified date range (`created_date >=from and created_date <=to`).
450+
451+
**Note:** The date range must not exceed 90 days, so ensure the `from` and `to` parameters are set accordingly.
452+
453+
**HTTP Request**
454+
455+
`GET /plugins/aviate-plugin/v1/health/bus/failed`
456+
457+
> Example Request:
458+
459+
```shell
460+
curl -X GET \
461+
-H 'Content-Type: application/json' \
462+
-H 'Authorization: Bearer ${ID_TOKEN}' \
463+
-H 'X-killbill-apiKey: bob' \
464+
-H 'X-killbill-apisecret: lazar' \
465+
'http://127.0.0.1:8080/plugins/aviate-plugin/v1/health/bus/failed?from=2025-01-01T00:00:00&to=2025-02-01T00:00:00'
466+
```
467+
468+
```java
469+
```
470+
471+
```ruby
472+
```
473+
474+
```python
475+
```
476+
477+
````php
478+
````
479+
480+
````javacript
481+
````
482+
483+
> Example Response:
484+
485+
````json
486+
[
487+
{
488+
"recordId": 13057,
489+
"className": "org.killbill.billing.subscription.api.user.DefaultEffectiveSubscriptionEvent",
490+
"eventJson": "{\"eventId\":\"479b6147-a1e2-4bee-a77a-0ded80084193\",\"subscriptionId\":\"cc1fdd4c-ded4-4d58-85ba-3b98e918be0d\",\"bundleId\":\"b32efdea-d8f3-40cf-93d0-eec4a9c1bfe5\",\"bundleExternalKey\":\"b32efdea-d8f3-40cf-93d0-eec4a9c1bfe5\",\"effectiveTransitionTime\":\"2025-01-01T00:00:21.000Z\",\"previousState\":null,\"previousPlan\":null,\"previousPhase\":null,\"previousPriceList\":null,\"previousBillCycleDayLocal\":null,\"nextState\":\"ACTIVE\",\"nextPlan\":\"pistol-monthly-notrial\",\"nextPhase\":\"pistol-monthly-notrial-evergreen\",\"nextPriceList\":\"notrial\",\"nextBillCycleDayLocal\":null,\"totalOrdering\":3786,\"transitionType\":\"CREATE\",\"remainingEventsForUserOperation\":0,\"startDate\":\"2025-01-01T00:00:21.000Z\",\"searchKey1\":1340,\"searchKey2\":1,\"userToken\":\"41041790-b1cc-4db8-9971-a0f05ead2389\",\"requestedTransitionTime\":\"2025-01-01T00:00:21.000Z\"}",
491+
"userToken": "41041790-b1cc-4db8-9971-a0f05ead2389",
492+
"createdDate": "2025-01-01T00:00:21.000Z",
493+
"creatingOwner": "DESKTOP-NCUS49R",
494+
"processingOwner": "DESKTOP-NCUS49R",
495+
"processingAvailableDate": "2025-01-01T00:00:21.000Z",
496+
"processingState": "FAILED",
497+
"errorCount": 3,
498+
"searchKey1": 1340,
499+
"searchKey2": 1
500+
},
501+
{
502+
"recordId": 4623,
503+
"className": "org.killbill.billing.subscription.api.user.DefaultEffectiveSubscriptionEvent",
504+
"eventJson": "{\"eventId\":\"2f896644-48f4-419e-8087-2cd7abd595bc\",\"subscriptionId\":\"d2f576d0-47d1-4118-b3c9-f84a50feafe7\",\"bundleId\":\"f92e8e8b-dad6-44a7-bb41-8e01073182af\",\"bundleExternalKey\":\"f92e8e8b-dad6-44a7-bb41-8e01073182af\",\"effectiveTransitionTime\":\"2024-09-01T08:35:28.000Z\",\"previousState\":null,\"previousPlan\":null,\"previousPhase\":null,\"previousPriceList\":null,\"previousBillCycleDayLocal\":null,\"nextState\":\"ACTIVE\",\"nextPlan\":\"blowdart-monthly-notrial\",\"nextPhase\":\"blowdart-monthly-notrial-evergreen\",\"nextPriceList\":\"notrial\",\"nextBillCycleDayLocal\":null,\"totalOrdering\":489,\"transitionType\":\"CREATE\",\"remainingEventsForUserOperation\":0,\"startDate\":\"2024-09-01T08:35:28.000Z\",\"searchKey1\":205,\"searchKey2\":1,\"userToken\":\"bd41f630-7636-4255-b1f5-395858a0f83e\",\"requestedTransitionTime\":\"2024-09-01T08:35:28.000Z\"}",
505+
"userToken": "bd41f630-7636-4255-b1f5-395858a0f83e",
506+
"createdDate": "2025-01-30T08:39:52.000Z",
507+
"creatingOwner": "DESKTOP-NCUS49R",
508+
"processingOwner": "DESKTOP-NCUS49R",
509+
"processingAvailableDate": "2025-01-30T08:40:20.000Z",
510+
"processingState": "FAILED",
511+
"errorCount": 3,
512+
"searchKey1": 205,
513+
"searchKey2": 1
514+
},
515+
{
516+
"recordId": 4618,
517+
"className": "org.killbill.billing.subscription.api.user.DefaultEffectiveSubscriptionEvent",
518+
"eventJson": "{\"eventId\":\"628fc92a-d09f-4360-9e09-b470f3f45184\",\"subscriptionId\":\"a8dc1e1b-ad18-45b7-85b8-3351e96b4a0d\",\"bundleId\":\"8f4ee610-2b70-4c05-89e1-dd69f9c86815\",\"bundleExternalKey\":\"8f4ee610-2b70-4c05-89e1-dd69f9c86815\",\"effectiveTransitionTime\":\"2024-09-01T08:35:28.000Z\",\"previousState\":null,\"previousPlan\":null,\"previousPhase\":null,\"previousPriceList\":null,\"previousBillCycleDayLocal\":null,\"nextState\":\"ACTIVE\",\"nextPlan\":\"pistol-monthly-notrial\",\"nextPhase\":\"pistol-monthly-notrial-evergreen\",\"nextPriceList\":\"notrial\",\"nextBillCycleDayLocal\":null,\"totalOrdering\":488,\"transitionType\":\"CREATE\",\"remainingEventsForUserOperation\":0,\"startDate\":\"2024-09-01T08:35:28.000Z\",\"searchKey1\":205,\"searchKey2\":1,\"userToken\":\"0153e06c-e5b1-435f-ad72-1c4b4e894818\",\"requestedTransitionTime\":\"2024-09-01T08:35:28.000Z\"}",
519+
"userToken": "0153e06c-e5b1-435f-ad72-1c4b4e894818",
520+
"createdDate": "2025-01-30T08:35:44.000Z",
521+
"creatingOwner": "DESKTOP-NCUS49R",
522+
"processingOwner": "DESKTOP-NCUS49R",
523+
"processingAvailableDate": "2025-01-30T08:35:44.000Z",
524+
"processingState": "FAILED",
525+
"errorCount": 3,
526+
"searchKey1": 205,
527+
"searchKey2": 1
528+
}
529+
]
530+
````
531+
532+
533+
**Request Body**
534+
535+
None
536+
537+
**Query Parameters**
538+
539+
| Name | Type | Required | Default | Description |
540+
|-----------------|--------|----------|--------------|--------------------------------------------------------------------------------------------------------------------------
541+
| **from** | string | true | none | Start of the date range (in `yyyy-dd-MMThh:mm:ss` format). |
542+
| **to** | string | false | Current time | End of the date range (in `yyyy-dd-MMThh:mm:ss` format). If omitted, all the data up to the current DateTime is returned. |
543+
| **maxNumberOfRows** | Long | false | 100 | The maximum number of rows to return) |
544+
545+
**Response**
546+
547+
If successful, returns a status code of 200 and the failed bus events data.
548+
549+
### Get Failed Notifications
550+
551+
Returns failed notifications. Basically returns the records from the `notifications_history` table that have `processing_state` as `FAILED`. Returns records for the specified date range (`effective_date >=from and effective_date <=to`).
552+
553+
**Note:** The date range must not exceed 90 days, so ensure the `from` and `to` parameters are set accordingly.
554+
555+
**HTTP Request**
556+
557+
`GET /plugins/aviate-plugin/v1/health/notifications/failed`
558+
559+
> Example Request:
560+
561+
```shell
562+
curl -X GET \
563+
-H 'Content-Type: application/json' \
564+
-H 'Authorization: Bearer ${ID_TOKEN}' \
565+
-H 'X-killbill-apiKey: bob' \
566+
-H 'X-killbill-apisecret: lazar' \
567+
'http://127.0.0.1:8080/plugins/aviate-plugin/v1/health/notifications/failed?from=2025-01-01T00:00:00&to=2025-02-01T00:00:00'
568+
```
569+
570+
```java
571+
```
572+
573+
```ruby
574+
```
575+
576+
```python
577+
```
578+
579+
````php
580+
````
581+
582+
````javacript
583+
````
584+
585+
> Example Response:
586+
587+
````json
588+
[
589+
{
590+
"recordId": 29896,
591+
"className": "org.killbill.queue.retry.RetryNotificationEvent",
592+
"eventJson": "{\"originalEvent\":\"{\\\"busEvent\\\":{\\\"extBusEvent\\\":{\\\"objectId\\\":\\\"809b5344-9308-4ab4-b196-032d7bbe152b\\\",\\\"objectType\\\":\\\"INVOICE\\\",\\\"eventType\\\":\\\"INVOICE_CREATION\\\",\\\"accountId\\\":\\\"1bb5106a-9623-42d1-a91e-43ae8c80626c\\\",\\\"tenantId\\\":\\\"62d242c3-6bb3-4608-84dd-cd2ec2f5edbf\\\",\\\"metaData\\\":null},\\\"extBusEventClass\\\":\\\"org.killbill.billing.beatrix.extbus.DefaultBusExternalEvent\\\",\\\"searchKey1\\\":1996520059780154065,\\\"userToken\\\":null,\\\"searchKey2\\\":7120827367919142408},\\\"busEventClass\\\":\\\"org.killbill.billing.osgi.KillbillEventRetriableBusHandler$OSGIBusEvent\\\"}\",\"originalEventClass\":\"org.killbill.queue.retry.SubscriberNotificationEvent\",\"originalEffectiveDate\":\"2025-07-03T00:00:01.000Z\",\"retryNb\":5}",
593+
"userToken": "",
594+
"createdDate": "2025-07-03T20:55:14.000Z",
595+
"creatingOwner": "DESKTOP-NCUS49R",
596+
"processingOwner": "DESKTOP-NCUS49R",
597+
"processingAvailableDate": "2025-07-04T00:01:19.000Z",
598+
"processingState": "FAILED",
599+
"errorCount": 0,
600+
"searchKey1": 1996520059780154000,
601+
"searchKey2": 7120827367919143000,
602+
"queueName": "notifications-retries:extBusEvent-listener",
603+
"effectiveDate": "2025-07-04T00:00:01.000Z",
604+
"futureUserToken": "e96d3b8e-596a-48c2-82f5-380f49ffc1fd"
605+
},
606+
{
607+
"recordId": 29895,
608+
"className": "org.killbill.queue.retry.RetryNotificationEvent",
609+
"eventJson": "{\"originalEvent\":\"{\\\"busEvent\\\":{\\\"extBusEvent\\\":{\\\"objectId\\\":\\\"809b5344-9308-4ab4-b196-032d7bbe152b\\\",\\\"objectType\\\":\\\"INVOICE\\\",\\\"eventType\\\":\\\"INVOICE_CREATION\\\",\\\"accountId\\\":\\\"1bb5106a-9623-42d1-a91e-43ae8c80626c\\\",\\\"tenantId\\\":\\\"62d242c3-6bb3-4608-84dd-cd2ec2f5edbf\\\",\\\"metaData\\\":null},\\\"extBusEventClass\\\":\\\"org.killbill.billing.beatrix.extbus.DefaultBusExternalEvent\\\",\\\"searchKey1\\\":1996520059780154065,\\\"userToken\\\":null,\\\"searchKey2\\\":7120827367919142408},\\\"busEventClass\\\":\\\"org.killbill.billing.osgi.KillbillEventRetriableBusHandler$OSGIBusEvent\\\"}\",\"originalEventClass\":\"org.killbill.queue.retry.SubscriberNotificationEvent\",\"originalEffectiveDate\":\"2025-07-03T00:00:01.000Z\",\"retryNb\":4}",
610+
"userToken": "",
611+
"createdDate": "2025-07-03T20:55:10.000Z",
612+
"creatingOwner": "DESKTOP-NCUS49R",
613+
"processingOwner": "DESKTOP-NCUS49R",
614+
"processingAvailableDate": "2025-07-03T20:55:14.000Z",
615+
"processingState": "FAILED",
616+
"errorCount": 0,
617+
"searchKey1": 1996520059780154000,
618+
"searchKey2": 7120827367919143000,
619+
"queueName": "notifications-retries:extBusEvent-listener",
620+
"effectiveDate": "2025-07-03T06:00:01.000Z",
621+
"futureUserToken": "cc945666-ad85-45f7-acfe-8111feba55ba"
622+
}
623+
]
624+
````
625+
626+
627+
**Request Body**
628+
629+
None
630+
631+
**Query Parameters**
632+
633+
| Name | Type | Required | Default | Description |
634+
|-----------------|--------|----------|--------------|--------------------------------------------------------------------------------------------------------------------------
635+
| **from** | string | true | none | Start of the date range (in `yyyy-dd-MMThh:mm:ss` format). |
636+
| **to** | string | false | Current time | End of the date range (in `yyyy-dd-MMThh:mm:ss` format). If omitted, all the data up to the current DateTime is returned. |
637+
| **maxNumberOfRows** | Long | false | 100 | The maximum number of rows to return) |
638+
639+
**Response**
640+
641+
If successful, returns a status code of 200 and the failed notifications data.
642+
643+
### Reinsert Failed Bus Events
644+
645+
Reinserts the specified bus events from the `bus_events_history` table into the `bus_events` table so that they are picked up for processing. The `creating_owner`, `processing_owner`, `processing_avialable_date`, `processing_state`, `error_count` fields are reset when the records are inserted into the `bus_events` table.
646+
647+
**HTTP Request**
648+
649+
`PUT /plugins/aviate-plugin/v1/health/bus/failed`
650+
651+
> Example Request:
652+
653+
```shell
654+
curl -X PUT \
655+
-H 'Content-Type: application/json' \
656+
-H 'Authorization: Bearer ${ID_TOKEN}' \
657+
-H 'X-killbill-apiKey: bob' \
658+
-H 'X-killbill-apisecret: lazar' \
659+
-d '[1,2]' \
660+
'http://127.0.0.1:8080/plugins/aviate-plugin/v1/health/bus/failed'
661+
```
662+
663+
```java
664+
```
665+
666+
```ruby
667+
```
668+
669+
```python
670+
```
671+
672+
````php
673+
````
674+
675+
````javacript
676+
````
677+
678+
**Request Body**
679+
680+
A List of `recordId` values from the `bus_events_history` table that have `processing_state=FAILED`.
681+
682+
**Query Parameters**
683+
684+
None
685+
686+
**Response**
687+
688+
If successful, returns a status code of 200 and an empty body.
689+
690+
### Reinsert Failed Notifications
691+
692+
Reinserts the specified bus events from the `notifications_history` table into the `notifications` table so that they are picked up for processing. The `creating_owner`, `processing_owner`, `processing_avialable_date`, `processing_state`, `error_count` fields are reset when the records are inserted into the `notifications` table.
693+
694+
**HTTP Request**
695+
696+
`PUT /plugins/aviate-plugin/v1/health/notifications/failed`
697+
698+
> Example Request:
699+
700+
```shell
701+
curl -X PUT \
702+
-H 'Content-Type: application/json' \
703+
-H 'Authorization: Bearer ${ID_TOKEN}' \
704+
-H 'X-killbill-apiKey: bob' \
705+
-H 'X-killbill-apisecret: lazar' \
706+
-d '[1,2]' \
707+
'http://127.0.0.1:8080/plugins/aviate-plugin/v1/health/notifications/failed'
708+
```
709+
710+
```java
711+
```
712+
713+
```ruby
714+
```
715+
716+
```python
717+
```
718+
719+
````php
720+
````
721+
722+
````javacript
723+
````
724+
725+
**Request Body**
726+
727+
A List of `recordId` values from the `notifications_history` table that have `processing_state=FAILED`.
728+
729+
**Query Parameters**
730+
731+
None
732+
733+
**Response**
734+
735+
If successful, returns a status code of 200 and an empty body.
736+
445737
### Fix Stuck Bus Entries
446738

447739
Fixes stuck bus entries. Basically resets the `creating_owner`, `processing_owner`, `processing_avialable_date`, `processing_state`, `error_count` fields in the `bus_events` table for the specified recordIds.

0 commit comments

Comments
 (0)