Skip to content

[ML] Update model_size_stats as soon as an anomaly detection job is opened #121168

@valeriy42

Description

@valeriy42

When we open a job, the memory tracker will reserve model_memory_limit bytes for this model on an ML node. However, this usage is not reflected in model_size_stats from GET _ml/anomaly_detectors/_stats?filter_path=jobs.model_size_stats until we start the datafeed and the job starts to produce the first results and report model_memory_stats.

This means that between opening the job and starting the datafeed, the reported memory usage in model_size_stats is 0:

{
    "model_size_stats": {
      "job_id": "my-job-id",
      "result_type": "model_size_stats",
      "model_bytes": 0,
      "total_by_field_count": 0,
      "total_over_field_count": 0,
      "total_partition_field_count": 0,
      "bucket_allocation_failures_count": 0,
      "memory_status": "ok",
      "categorized_doc_count": 0,
      "total_category_count": 0,
      "frequent_category_count": 0,
      "rare_category_count": 0,
      "dead_category_count": 0,
      "failed_category_count": 0,
      "categorization_status": "ok",
      "log_time": 1736525034132
    }
  }

The actually should be something like

{
    "model_size_stats": {
      "job_id": "my-job-id",
      "result_type": "model_size_stats",
      "model_bytes": 0,
      "model_bytes_memory_limit": 11534336,
      "assignment_memory_basis": "model_memory_limit",
      "total_by_field_count": 0,
      "total_over_field_count": 0,
      "total_partition_field_count": 0,
      "bucket_allocation_failures_count": 0,
      "memory_status": "ok",
      "categorized_doc_count": 0,
      "total_category_count": 0,
      "frequent_category_count": 0,
      "rare_category_count": 0,
      "dead_category_count": 0,
      "failed_category_count": 0,
      "categorization_status": "ok",
      "log_time": 1736525034132
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    :mlMachine learning>bugTeam:MLMeta label for the ML teampriority:normalA label for assessing bug priority to be used by ES engineersv8.19.0v9.1.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions