elastic / uptime

This project includes resources and general issue tracking for the Elastic Uptime solution
12 stars 3 forks source link

Create uptime monitors saved object data model #396

Closed shahzad31 closed 2 years ago

shahzad31 commented 2 years ago

we will have to define data model to save uptime monitor configuration, we will leverage kibana saved objects apis to do that. Example monitor attributes are id, Name, type, urls etc all the data that user will define while creating a monitor will need to be saved in a saved object , detailed options can be found here https://www.elastic.co/guide/en/beats/heartbeat/current/configuration-heartbeat-options.html

we will not mark these saved objects as hidden, we will not store any sensitive data, so no need to use encrypted saved objects.

Mappings

Depending on the UI requirement we may have to index some of the data from the saved object, like monitor name, url etc

Permission

Each saved object should be scoped to user space

Nice to have

In the management section, we will provide a helpful title, that will be a monitor name, and also provide a link back to the uptime ui.

Example saved object will look like this

    {
      type: 'uptime-monitor',
      id: '33e001c0-4b78-11ec-a728-d36cfa2787e0',
      attributes: {
        type: 'http',
        schedule: '@every 3m',
        timeout: '16s',
        urls: ['https://localhost.com'],
        max_redirects: '0',
        'response.include_body': 'on_error',
        'response.include_headers': true,
        'check.request.method': 'GET',
        name: 'Test',
        tags: ['testing', 'dev', 'elastic'],
      },
      references: [],
      coreMigrationVersion: '8.1.0',
      updated_at: '2021-11-22T09:40:18.012Z',
      version: 'WzI2NzgsMV0=',
      namespaces: ['default'],
      score: 0,
    },

Testing

We don't need to write any tests for the setting up saved objects, this can be tested later while creating/deleting/editing saved objects.

All the related documents regarding saved objects can be found here https://www.elastic.co/guide/en/kibana/master/managing-saved-objects.html