#Lev Chepiga-sub-metered-usage

1 messages · Page 1 of 1 (latest)

earnest wigeon
#

Hey, can you share the subscription ID?

left edge
#

sub_1LBESMHKtLNIE75b1xVuLy7g

earnest wigeon
#

Taking a look

left edge
#

it was one usage session
which generated 1027 records
and triggered invoice creating by threshold twice
finally stripe created usage 1028

earnest wigeon
#

As you can see, they total 1028

#

Trying to find the API requests records that made them

left edge
#

yes
i watched this logs before
didnt found any useful, unfortunately

#

thank you for helping

earnest wigeon
#

Still looking into this, but my expectation is that the records match the API requests you made to us

left edge
#

because it always 1 record higher
looks really strange)

earnest wigeon
#

Yep, checking on it now

#

Are you reporting usage via the API or Dashboard directly?

left edge
#

api

#

only

earnest wigeon
#

Can you share the code that makes that request?

left edge
#

here usage creates with quantity 1 all the time

#

overall its aws sqs fifo queue where i put all events, and this queue were handling by lambda which working with stripe API

earnest wigeon
#

Ok, found the records. Difficult to pinpoint a single issue as there are many, many requests (seemingly incrementing usage by 1 each time?)

#

Is it possible for you to batch these usage reports into a single daily job? Perhaps you're not correctly accounting for some of the requests – a lot of them are sent milliseconds apart

left edge
#

yes
in that case 1 by 1
its unusual load which i trying to handle

#

because mostly it will be like 100 records for day for 1 subscription

earnest wigeon
#

Like perhaps, your addStatisticDynamoDbRecord call fails, the catch block is fired and you revert your local count but don't update the record count at Stripe

left edge
#

so its not necessary to create some daily basis usage reporting only for unusual high load periods
also in that case will be delay before user can see his expenses

left edge
earnest wigeon
#

Hmm, the issue definitely lies somewhere in your function/code. We've 533 requests for usage records for that specific subscription item

left edge
#

as i see, stripe somehow combine that usage reports to one, even if it have two different reports for 1, stripe shows 1 usage report for 2
maybe it combines incorrectly?

earnest wigeon
#

Perhaps because they're being sent at almost identical times. I'm not sure

#

Is the quantity value always 1 in your code?

#

This is why I'd recommend batching the usage records and making a single request daily via a queue or something

left edge
limpid pond
#

Hi! I'm taking over this thread, give me a few minutes to catchup.

left edge
#

hello
ok, thanks

limpid pond
#

I would suggest the same thing as ynnoj:

I'd recommend batching the usage records and making a single request daily via a queue or something

left edge
#

and if i dont have opportunity to batch them?

limpid pond
#

From our end everything seems to be OK. So it’s likely your system that might have missed some items in your logs. You’re sending many requests (multiple a second) so it’s possible you failed to log something at some point which is normal as you start to build and scale a system like this