elastic / elastic-integration-corpus-generator-tool

Command line tool used for generating events corpus dynamically given a specific integration
Other
21 stars 12 forks source link

Return better error when field is missing #123

Open ruflin opened 8 months ago

ruflin commented 8 months ago

When the benchmark command is run in elastic-package and something is off with the field definition, the following error is returned:

Error: error running package stream benchmarks: could not complete benchmark run: error while generating event for streaming: generate called on a field not present in fields yaml definition

This misses the important information about which benchmark, which fields.yml and which field. To make debugging for template creators as easy as possible, all this info should be provided.

The error message for the field can be found here: https://github.com/elastic/elastic-integration-corpus-generator-tool/blob/73d240b5ed15bf9b37303809a3d72ff1eaf29b10/pkg/genlib/generator_with_text_template.go#L16 and it seems it is triggered, when the channel is closed which can be found here: https://github.com/elastic/elastic-integration-corpus-generator-tool/blob/73d240b5ed15bf9b37303809a3d72ff1eaf29b10/pkg/genlib/generator_with_text_template.go#L78 Unfortunately the info is not passed through the channel or added to the error message.