https://github.com/flowup/intro-task
https://github.com/flowup/intro-task
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/flowup/intro-task
- Owner: flowup
- Created: 2021-08-27T07:10:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T14:38:38.000Z (over 4 years ago)
- Last Synced: 2025-02-15T16:52:05.657Z (over 1 year ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Event aggregator
Event aggregator is a simple server service. It should be written in **Golang** or **Node** and run with the newest version.
Try to use only standard libraries and implement all data handling in memory.
The service should be able to capture incoming *events* and provide aggregated data.
Therefor, there should be 2 main endpoints for the service:
```
- GET /:name?from=date&to=date&interval=minutes - gets aggregated data
- POST /:name - creates new event
```
### Events
Every event is defined by it's name. Server should be able to save these events and group them by their name.
Every event should be associated with the time of its arrival.
### Aggregations
Users requesting the GET endpoint should be able to get aggregated data from the server. Aggregations are limited by two dates.
Interval must also be set for every aggregation. The interval is set in minutes.
Consider that there will be significantly more write requests then read operations.
### Examples
**Event**
```
POST /click
```
**Aggregation**
Request:
```
from=1478116800 (Human time (GMT): Wed, 02 Nov 2016 20:00:00 GMT)
to=1478120400 (Human time (GMT): Wed, 02 Nov 2016 21:00:00 GMT)
interval=10 (10 minutes)
```
That means the raw request will be:
```
GET /click?from=1478116800&to=1478120400&interval=10
```
Response:
```
[
{ click: 100 }, // first 10 minutes
{ click: 200 }, // 10-20 minutes
{ click: 300 }, // ...
{ click: 200 },
{ click: 100 },
{ click: 100 }
]
```
### Bonus
Implement a test validating listing functionality, when 5 **concurrent** users are sending events to the service.