Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: call "Retrieve current usage" API,no return value #344

Open
ytrjp opened this issue Apr 28, 2024 · 3 comments
Open

[BUG]: call "Retrieve current usage" API,no return value #344

ytrjp opened this issue Apr 28, 2024 · 3 comments

Comments

@ytrjp
Copy link

ytrjp commented Apr 28, 2024

No description provided.

@ytrjp
Copy link
Author

ytrjp commented Apr 28, 2024

restart lago-api docker server, Retrieve current usage API back to available

@ytrjp
Copy link
Author

ytrjp commented Apr 28, 2024

  1. call current usage API
    {
    "customer_usage": {
    "from_datetime": "2024-04-26T02:25:28Z",
    "to_datetime": "2024-04-30T23:59:59Z",
    "issuing_date": "2024-04-30",
    "currency": "CNY",
    "amount_cents": 2000,
    "total_amount_cents": 2000,
    "taxes_amount_cents": 0,
    "lago_invoice_id": null,
    "from_date": "2024-04-26",
    "to_date": "2024-04-30",
    "amount_currency": "CNY",
    "total_amount_currency": "CNY",
    "vat_amount_currency": "CNY",
    "vat_amount_cents": 0,
    "charges_usage": [
    {
    "units": "0.0",
    "events_count": 0,
    "amount_cents": 0,
    "amount_currency": "CNY",
    "charge": {
    "lago_id": "55d41098-31c6-4c65-b1f9-bb325878b443",
    "charge_model": "package",
    "invoice_display_name": ""
    },
    "billable_metric": {
    "lago_id": "6e6b5d33-5951-4039-a957-0bf1ba31bffc",
    "name": "存储容量",
    "code": "storage",
    "aggregation_type": "sum_agg"
    },
    "filters": [],
    "groups": [],
    "grouped_usage": []
    },
    {
    "units": "2007442.0",
    "events_count": 11,
    "amount_cents": 2000,
    "amount_currency": "CNY",
    "charge": {
    "lago_id": "9799cc58-c174-4d3d-a263-a4c17afb86b2",
    "charge_model": "package",
    "invoice_display_name": ""
    },
    "billable_metric": {
    "lago_id": "9c0a2dbd-2a1c-41a7-9b37-e3643f31a74a",
    "name": "视频时长",
    "code": "gen_video_duration",
    "aggregation_type": "sum_agg"
    },
    "filters": [],
    "groups": [],
    "grouped_usage": []
    }
    ]
    }
    }

  2. send event
    {
    "event": {
    "transaction_id": "ea81bb9b-dc32-4393-ab63-86a0c178a772_1557_1714295412",
    "external_customer_id": "ea81bb9b-dc32-4393-ab63-86a0c178a772",
    "external_subscription_id": "payment_20240426_022511_14eb776",
    "code": "gen_video_duration",
    "timestamp": 1714295412,
    "properties": {
    "plan_code": "month_vip",
    "storage_usage": 0,
    "gen_video_duration_usage": 100600
    }
    }
    }

  3. call current usage API
    units:not change

"units": "2007442.0",
"events_count": 11,
"amount_cents": 2000,
"amount_currency": "CNY",
"charge": {
"lago_id": "9799cc58-c174-4d3d-a263-a4c17afb86b2",
"charge_model": "package",
"invoice_display_name": ""
},

@Deathcall404
Copy link

Deathcall404 commented Sep 25, 2024

Facing the same issue, investigated it a bit.

It is an issue with postgres connection, at least for me. So I exposed sidekiq endpoint on lago and checked dead messages.
The error message I saw was

ActiveRecord::ConnectionNotEstablished: connection to server at "xxx.xx.xx.xx", port 5432 failed: FATAL: remaining connection slots are reserved for roles with the SUPERUSER attribute

I will need a way to increase the number of max connection to the lago postgres db, is there any way I can do it through helm charts of lago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants