elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.72k stars 8.14k forks source link

[Logs + Metrics UI] Gather requirements for a test data generator #57374

Closed weltenwort closed 9 months ago

weltenwort commented 4 years ago

Since the creation of test data was identified as a major pain during the last team retrospectives, let's gather some requirements a solution would have to fulfill to cover most of our test data needs. The goal is to arrive at a set of requirements that can be used to implement a test data generation API and tools.

In particular, I'd be interested in answers to following questions:

I'd love to hear as much input as possible on the above aspects in the comments so I can amend the requirements I started out with.

Requirements

API Proposals

Schema

A possible way of specifying both the mapping and the statistical properties of the generated documents would be to use a superset of the index creation body as the schema. It could be enhanced with some data-generator meta keys (__data_generator in the following example), which would be interpreted and stripped out during data generation:

{
  "__data_generator": {
    "type": "singleIndex",
    "default_seed": "foo",
    "samples": 10000,
    "index_name": "filebeat-8.0.0-generated"
  },
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date",
        "__data_generator": {
          "type": "randomUniform",
          "min": 1581452864420,
          "max": 1581539264420
        }
      },
      "event": {
        "type": "object",
        "properties": {
          "dataset": {
            "type": "keyword",
            "__data_generator": {
              "type": "randomPickOne",
              "values": ["word1", "word2", "word3", "word4"]
            }
          }
        }
      },
      "message": {
        "type": "text",
        "__data_generator": {
          "type": "randomPattern",
          "patterns": [
            {
              "pattern": "{{ method }} {{ url }} {{ statusCode }}",
              "values": {
                "method": {
                  "type": "randomPickOne",
                  "values": ["GET", "POST"]
                },
                "url": {
                  "type": "randomUrl"
                },
                "statusCode": {
                  "type": "randomPickOne",
                  "values": [200, 404]
                }
              }
            }
          ]
        }
      }
    }
  }
}

Test API

import exampleSchema from './example_schema.json';

const seed = "seedForThisTestSuite";

export default function createExampleTestSuite({ getService }: FtrProviderContext) {
  const dataGenerator = getService('dataGenerator');

  describe('my test suite', () => {
    before(async () => {
      await dataGenerator.generateData(exampleSchema, seed);
    });

    after(async () => {
      await dataGenerator.removeData(exampleSchema);
    })

    it('behaves as expected', async () => {
      // ...
    });
  });
});
elasticmachine commented 4 years ago

Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui)

elasticmachine commented 10 months ago

Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)

weltenwort commented 9 months ago

IMO we could close this now that we can generate logs using synthtrace.