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

Nightscout treatments will be lost if they are the same type in the same second #379

Open
trixing opened this issue Feb 3, 2018 · 2 comments

Comments

@trixing
Copy link

trixing commented Feb 3, 2018

Nightscout deduplicates events by eventType and created_at in lib/server/treatments.js

NightscoutUploadKit uses TimeFormat which uses the ISO8601 formatter, which does the following:

formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssX"

That way if we try to write 2 events in the same second the second one overwrites the first.

I'd suggest changing the format at least for the treatments to capture milliseconds

formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSX"

or use the solution from this stackoverflow hint to capture microseconds

https://stackoverflow.com/questions/43123944/how-to-configure-dateformatter-to-capture-microseconds/43124982

@ps2
Copy link
Owner

ps2 commented Feb 5, 2018

I believe the pump clock only has time resolution of 1s. If NS is dropping unique events that share the same timestamp, then this would not fix the issue.

@trixing
Copy link
Author

trixing commented Feb 5, 2018

I noticed this behavior because I changed my AnalyticsManager and loggly library to log events to Nightscout instead of 3rd party resources (with a custom eventType). Those sources will actually generate more than one event per second from time to time.

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