matheusmessora/nursery

Create Metric Endpoint

Closed this issue · 0 comments

Metric
Every Monitor can send Metrics to Nursery ecosystem. This domain is responsible for Y axis of the graphs dashboard.
A monitor is responsible to N metrics, for example, MemoryMetric, CPUMetric, IOMetric, AccessMetrics, and so on.

For now, a Metric has the following attributes:

  • Monitor: the monitor that is sending this Metric.
    -- This monitor should be on RUNNING status to have granted access for publishing Metrics.
  • ID (8~32 String)
  • Name: Probably the Y axis name on graphs dashboard (Example: Memory)
  • Type: Identifies what is the MetricData type. For now, it only accepts SingleValuedData.
    • MetricData #9
  • TimeInterval: The time (in minutes) that the monitor will send MetricData for this Metric

MetricEndpoint

URL: /metric
Accepted Methods: GET(getAll and getByID) POST

ON POST:
It should validate:

  • The monitor is mandatory
  • The monitor must not be on UNREGISTERED or STOPPED state
  • The name is mandatory
  • TimeInterval is mandatory
  • TimeInterval must be >= 1 AND <= 1440 (between one minute and one day)

ON GET:
It should be able to GET Metric by ID.
URL: /metric/{id}

It should be able to list all Metrics by MonitorID
URL: /metric?monitor_id={monitorId}