Openfoodnetwork: Add Logging to Subscriptions

Created on 13 Nov 2019  路  14Comments  路  Source: openfoodfoundation/openfoodnetwork

Description

As a developer I want to be able to see logs for Subscriptions.

[From @luisramos0]
There's a design flaw in the subs module: absence of logging.
This subs module is full of automagic stuff like generating proxy orders and then real orders, and then completing those orders and sending summaries to people...

Again and again as the code is used things will happen and users will want to know what has happened? why this or why that. Sometimes the user will fail, miss the point, sometimes we will fail, bugs.

To support such a process we need logging that lets us monitor what automatic processes were executed, and what/why did they do what they did.

More context for this issue is given in the comments in #4396

Suggested implementation:
Enable existing logs on delayedjob, and add a custom logging capability to the app and issue some specific log messages from the code.

Acceptance Criteria & Tests


  1. Dev Test?




    1. 4.

This is an improvement or tech debt... not really a bug.
I am adding an S2 label as this is replacing #4396.

If you disagree that this is an S2 please say so.... but I really hope you don't. UK keep getting new subs users and every one that comes on makes me want to cry due to the black hole of problems we've experienced.

All 14 comments

Thanks for creating the issue @lin-d-hop
In terms of tagging I think I'd remove the s2 tag, this is not a S2 bug. We can just get it on top of dev ready because we agree is top priority because it's associated with an S2 bug. I'd definitely not create a new (non bug) s2 tag @sigmundpetersen

Yeah it was not a new label, guess they were created for putting severity on tech debt mostly. Agree we can remove from this issue.

4527 is now ready to go forward but it does not include all that was needed, so I move this back to dev ready because ater 4527 a user will still be able to link/unlink a schedule from an OC without any trace or log...
See comment here for tech details.

Are you taking it on again later Luis or do you want to unassign as well?

ah, yeah, for now I am on stripe sca.

Shall I mark this as blocked by #4527?

What remains to be done after #4527 is merged?

Yeah, we can take care of 4527 first. But it's not blocking it.
What remains is to capture all changes to links between schedules and order cycles. It's what was removed from 4527 because it was not working... according to Maikel's theory, maybe we need to add a mapping class for the association table and then add the timestamp:
https://github.com/openfoodfoundation/openfoodnetwork/pull/4527#issuecomment-571448689
With the timestamp we would be able to capture the creation date.
Otherwise we may need to right log messages in a few places to capture that change.

We have another s2 issue (I'll investigate a bit more before opening) of a Shop saying that their subscriptions were not created this week.
If only we had logging to help us track down the problem :pray: :-)

not done yet as described in my previous comment.

@luisramos0 https://github.com/openfoodfoundation/openfoodnetwork/pull/5332 is what you wanted, right?

I'll focus now on logging. Specifically, adding/removing OCs to a schedule.

I think 5332 is enough actually!!!
We already have all the info we need with that and the versions table.

I think #5332 closes this issue.

I believe the additional logging work is not related to schedules and OCs now , but rather to #5294 which relates to, I think!, subscription_line_items and stock levels...

alright then, I'll update the PR and get to that issue :+1:

Was this page helpful?
0 / 5 - 0 ratings