EIDA / eida-statistics

Aggregated statistics of EIDA nodes
GNU General Public License v3.0
0 stars 0 forks source link

Add a webservice for getting the statistics #12

Closed jschaeff closed 1 year ago

jschaeff commented 1 year ago

First task for this is to build an API in the openAPI3 standard, for instance using the swagger online tools.

In order to imagine a suitable API, you can look at the matrix document. First 2 rows define the questions and the granularity level.

The code attached to this project needs a better documentation, I'm on it (see issue #11)

The datamodel is specified in the code : https://github.com/EIDA/eida-statistics/tree/main/backend_database

You can use this project to bring up your own empty database if needed.

You can create a directory for the webservice specification and implementation at the root of this project.

jschaeff commented 1 year ago

Query method

the aggregate_on parameter needs a clear explanation for the user.

GET statistic/1/query?start=2021-01,end=2021-12,net=NL,sta=STA*,country=GR,FR&aggregate_on=month,datacenter

{
   "request_metadata": "",
   "matching": "net=NL,sta=STA*,country=GR,FR,start=2021-01,end=2021-12",
   "aggregated_on": ["month", "datacenter", "country", "net", ...],
   "values": [
   {
    "month": "2021-01",
    "net": "NL",
    "sta": "STA*",
    "loc": "*",
    "cha": "*",
    "data_centre": "NOA",
    "country": "*",
    "bytes": 456684,
    "requests": 43,
    "successfull_requests": 30,
    "nbclients": 345 # This is an evaluation of the internal representation in the database
    },
    {
    "month": "2021-02",
    "net": "NL",
    "sta": "STA*",
    "loc": "*",
    "cha": "*",
    "data_centre": "RESIF",
    "country": "*",
    "bytes": 456684,
    "requests": 43,
    "successfull_requests": 30,
    "nbclients": 345 # This is an evaluation of the internal representation in the database
    }
   ]
}

Stats method

more robot oriented

GET statistic/1/dataselect_stats?start=2021-01,end=2021-12,net=NL,sta=STA*,country=GR,FR

{
  "version": "",
  "results": [
    {
    "month": "2021-01",
    "net": "NL",
    "sta": "STA1",
    "loc": "00",
    "cha": "HHZ",
    "datacentre": "NOA",
    "country": "GR",
    "bytes": 456684,
    "requests": 43,
    "successfull_requests": 30,
    "clients": "\x128b7fffffffff8ef137c60000000002832c9b" # hll object
    },
    ...
    ]
}
jschaeff commented 1 year ago

Today's review:

jschaeff commented 1 year ago

Webservice released in production. Thanks to the work of @vpet98