Skip to content

[Logs UI] Analysis setup should validate fields #46369

@Kerry350

Description

@Kerry350

Summary

We should add up front validation to aid in onboarding, this would notify the user of a problem with their source configuration before they hit "Create ML jobs". We should add a validation API endpoint that we can hit with a simple request payload like the following:

interface MlModuleValidationRequest {
  data: {
    // The timestamp value, which is timestamp from the users' source configuration
    timestamp: string;
    // The indexPatternName value, which is logAlias from the users' source configuration
    indexPatternName: string;
  };
}
interface MlModuleValidationResponse {
  data: {
    errors: Array<{
      // timestamp / indexPatternName
      field: string;
      // Descriptive message -  should contain the problem, and how to fix the problem 
      message: string;
    }>
  }
}

(The field names here match the names used by the ML module setup API call).

Acceptance criteria

  • A new API endpoint will exist at POST /api/infra/log_analysis/validate_ml_module
  • This endpoint will check that the indexPatternName matches some indices that exist
  • If the above is true, it will check that at least one document exists in the matching indices with the corresponding timestamp field that has been set (an error will be hit if setup is called and no documents exist with the relevant timestamp).
  • The timestamp field should also be checked for a type of date from the field capabilities API
  • With the introduction of the partitioning field in [Logs UI] Analysis setup should be extended to support configurable partitioning field #46365 we should also check this field has a correct keyword type from the field capabilities API. It should be taken into account that it's okay if documents don't have this field set, as we will make use of the use_null option.
  • The setup screen should display an error if the validation endpoint returns an error. This should be run up front as soon as the setup screen loads so that the user is informed of problems as early as possible, they shouldn't need to hit the create button before seeing this. We may want to disable the create button until the initial status check is performed.
  • The create button should be disabled when we know there is a problem, and an error is displayed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions