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

unify /volume and /event-aggregates into /analytics #200

Closed
Ivshti opened this issue Jul 20, 2019 · 0 comments · Fixed by #201
Closed

unify /volume and /event-aggregates into /analytics #200

Ivshti opened this issue Jul 20, 2019 · 0 comments · Fixed by #201

Comments

@Ivshti
Copy link
Member

Ivshti commented Jul 20, 2019

merge the /volume functionality into /event-aggregates, however:

  • supports both cases: either authenticate as someone and get their stats only, or get global stats; however, global stats would be limited to certain combinations of periods and intervals (e.g. daily for a month, hourly for a day, etc.)
  • the authenticated calls should get data either for a single channel, or for all channels; the global calls will always be for all channels
  • rather than using the $day, $month and etc. mongodb operators, use what we use in volume ($mod): https://github.com/AdExNetwork/adex-validator/blob/05-stable/routes/volume.js#L29 ; each datapoint will use time as it's identifier, and should return it in a number format (rather than stringified date) ; this should greatly simplify the pipeline
  • to avoid excessive CPU load, calls without authentication, that retrieve global stats, should be cached in redis for interval/2 time
  • should be all handled in a separate file, routes/analytics.js; might use the channels middleware if we need to load a full channel

for example, aggr would be [{ time: 1563645559247, value: "1023022" }]

API:

  • /analytics - optional authentication; queries for all channels
  • /:channelId/analytics - required authentication; channel specific queries

If authentication is passed, it will only return aggregates for this particular earner; otherwise it will return a sum of all earners (like /volume now)

Both take timeframe, limit, eventType, metric; only certain combinations of timeframe and limit will be allowed for /analytics without authentication

Since this is a breaking change, it should be discussed with @ivopaunov and @samparsky first

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.

1 participant