matheusmessora/nursery

Create MetricData endpoint

Closed this issue · 0 comments

Data
Every Metric can send Data for the timeInterval specified in Metric. This domain is responsible for X axis of the graphs dashboard.
A Metric is responsible to N metricData.

For now, a MetricData has the following attributes:

  • Metric: the Metric that is sending this MetricData.
  • ID
  • Value: Integer (for now)
  • DateCreation: It holds the date of the received data.

DataEndpoint

URL: /data

ON POST:
It should validate:

  • The metric is mandatory
  • The monitor must not be on UNREGISTERED or STOPPED state
  • The Value is mandatory
  • A rate-limit must be applied on sending new metrics. The rate-limit is based on Metric.timeInterval value. The time range between posts on the same Metric can not be below the Metric.timeInterval value.

On every post, the DateCreation must be populated

ON GET:
It should be able to GET List only by Metric.id
URL: /data?metric_id={metricId}