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

Docs #1

Open
sindresorhus opened this issue Dec 12, 2012 · 2 comments
Open

Docs #1

sindresorhus opened this issue Dec 12, 2012 · 2 comments

Comments

@sindresorhus
Copy link
Member

Need more docs when the Analytics API is public.

  • How does it work.
  • Where in Analytics can you find the metrics
  • Use cases of where it could be useful to have metrics
  • ...
@sindresorhus
Copy link
Member Author

Braindump

I choose to split it up into two processes. The first one handles the user-side of things, tracking, permission, etc. When a user wants to track a path, they call .track() which then parses and adds it to the queue, and then calls ._save which is responsible for messaging the record to the second process push.js. The reason for the queue is to be able to handle bursts of consecutive track() calls by combining the queue with debouncing.

The second process is responsible for getting messages with queues and handling them. It does this by reading the saved queue, merging it with the live queue, then deleting the saved queue, and then trying to send the whole queue out. If it fail, in case of eg. offline, it will save the queue again.

The reason for the split is separation of concern and the benefit that the sending of stats will never influence the application using the lib. If I hadn't done that, a slow internet connection could potentially slow down parts of the app.

Records are saved in a YAML file using our own configstore module.

@iamstarkov
Copy link

Use cases of where it could be useful to have metrics

Currently thinking this module is great, but still don’t get how can I apply it to my own modules

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