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

Error: time data '2022-12-07T10:19:24' does not match format '%Y-%m-%dT%H:%M:%S%z' #1

Closed
ngosang opened this issue Dec 7, 2022 · 2 comments

Comments

@ngosang
Copy link
Owner

ngosang commented Dec 7, 2022

I saw this error after using the Android App for Restic. It includes Restic 0.12 and the repository was created with Restic 0.13 ? => https://github.com/lhns/restic-android

image

ERROR    Unable to collect metrics from Restic. Error: time data '2022-12-07T10:19:24' does not match format '%Y-%m-%dT%H:%M:%S%z'
@martonivan
Copy link

martonivan commented Feb 2, 2023

Hello,

I've faced the very same issue. I was using the current github image on a recently created restic (restic 0.12.1 compiled with go1.17 on linux/amd64; directly from Ubuntu repo) repository on Linux (Linux docker-1 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux).

restic output for that variable is: '2023-02-01T14:14:19.30760523Z'
after your transformation this becomes: '2023-02-01T14:14:19'

What's the point in the regexp in line https://github.com/ngosang/restic-exporter/blob/main/restic-exporter.py#L100?

Why not removing the trailing numbers after the period only?

martonivan pushed a commit to martonivan/restic-exporter that referenced this issue Feb 2, 2023
In case of UTC time string given in the following format: '2023-02-01T14:14:19.30760523Z', the current regexp fails.

It is enough to remove the milliseconds by targeting them directly
instead of removing all the characters after the first period('.')
found in string.

fixes ngosang#1
@ngosang ngosang closed this as completed in 8419058 Feb 2, 2023
@ngosang
Copy link
Owner Author

ngosang commented Feb 2, 2023

Fixed in 8419058 / Release 1.1.0

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

Successfully merging a pull request may close this issue.

2 participants