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

Generate report on run #1072

Open
sk33ve opened this issue Feb 1, 2025 · 5 comments
Open

Generate report on run #1072

sk33ve opened this issue Feb 1, 2025 · 5 comments

Comments

@sk33ve
Copy link

sk33ve commented Feb 1, 2025

Summary

It would be really great if there was an option to generate a report when the tool is run. This could output JSON (or human readable) with something like:

  • options it was run with
  • success/fail (maybe an error code?)
  • total photos in library
  • photos downloaded (successes/failures etc?)
  • photos which were deduplicated etc

Context

I run icloudpd on a headless server on a cron job - and I'd love it to push the output somewhere I can check on it (I use Home Assistant a lot so perhaps generate an event there or send an email?)

As far as I can tell the existing notification email is just for OAuth expiry? I have struggled to get it working though!

I'm a relatively competent Sofware Engineer (although I don't know much Python!) so I'm happy to work on this, but wanted to get some feedback on the idea first!

@AndreyNikiforov
Copy link
Collaborator

AndreyNikiforov commented Feb 1, 2025

What criteria you used and decision you reached while choosing cron job vs --wait-for-interval parameter for the headless server scenario?

When exploring options for monitoring headless setup, I was considering approach with metrics, rather than output of the summaries. Then metrics can be used for alerting/notification though any external system. Implementation wise, pull-base approach seems fit well as it has little to no impact for user without monitoring.

I have not committed to adding metrics. If you want to contribute, I suggest you write RFC first.

@sk33ve
Copy link
Author

sk33ve commented Feb 4, 2025

What criteria you used and decision you reached while choosing cron job vs --wait-for-interval parameter for the headless server scenario?

Really just because I run a bunch of other things on a cron - and sometimes simplicity comes through doing everything the same way :-) If there is a reason to use the --wait-for-interval I could swap to it easily enough

Metrics...

I think metrics are great, have done a bit with OpenTelemetry and use DataDog. It feels like it could be quite heavyweight if someone doesn't have the infrastructure in place for it. I was thinking something more lightweight really, just a few fields outlining what happened so it could go into the notification email already in place, or be consumed by something else like HomeAssistant. There is probably a good case for both to be honest.

Pardon my ignorance but when you say create and RFC is there a guide/example/docs somewhere? I had a look but can't find anything? Happy to do it if it is the best approach.

@AndreyNikiforov
Copy link
Collaborator

If there is a reason to use the --wait-for-interval I could swap to it easily enough

You can have webui for password & MFA. Keyring for storing password may not be as valuable when running in headless mode with webui. No reason to switch from cron if that works for you IMO

I think metrics are great, have done a bit with OpenTelemetry and use DataDog. It feels like it could be quite heavyweight if someone doesn't have the infrastructure in place for it. I was thinking something more lightweight really, just a few fields outlining what happened so it could go into the notification email already in place, or be consumed by something else like HomeAssistant. There is probably a good case for both to be honest.

#183 - some thoughts on subject of execution summary

Pardon my ignorance but when you say create and RFC is there a guide/example/docs somewhere? I had a look but can't find anything? Happy to do it if it is the best approach.

#1046 as example. Can expand this post. I am looking for a) problem you are trying to solve b) evaluation of solution options. I would suggest these details if there is a commitment to implementing it.

@AndreyNikiforov
Copy link
Collaborator

a) problem you are trying to solve

For clarity, the problem is the one why you need summary and HA integration, not the summary itself.

@sk33ve
Copy link
Author

sk33ve commented Feb 6, 2025

That is really useful information, thank you. It looks like #183 is a really similar request actually.

It doesn't need to be any thing fancy, just a short summary of what occurred.

Having the Summary in JSON format would be extra useful for people wanting to consume it to send to other things (which in my case involves sending it to HomeAssistant, because that is where I tend to gather all the automated things which happen in the house, it is just a really nice tool for that kind of use-case). Even if we had a summary though, it would be easy enough to transform that into JSON with a script if necessary - the bit that is quite laborious at the moment is having to parse the output to build up the summary.

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

No branches or pull requests

2 participants