opensearch-project / index-management

🗃 Automate periodic data operations, such as deleting indices at a certain age or performing a rollover at a certain size
https://opensearch.org/docs/latest/im-plugin/index/
Apache License 2.0
52 stars 107 forks source link

[FEATURE] Stats Framework for Index Management - Phase II #1154

Open sarthakaggarwal97 opened 2 months ago

sarthakaggarwal97 commented 2 months ago

Granular Index Management Stats

In continuation from #1153, this issue is to additionally support indices and policies as dimensions.

GET _plugins/_ism/stats/<dimension>/<target>/<action>/statName1,statName2?pretty
{
  "cumulative": {
    "actions": {
        "rollover": {
          "total_executions": 100,
          "total_successes": 190,
          "total_failures": 5,
          "total_execution_time": "5ms"
      },
  },
  "indices": {
    "<index_name>": {
      "policy_name": "<policy_name>",
      "actions": {
        "rollover": {
          "total_executions": 100,
          "total_successes": 190,
          "total_failures": 5,
          "last_execution_time": "2024-03-20T12:00:00Z",
          "total_execution_time": "5ms"
        }
        // Other ISM actions and their statistics
      }
    },
    // Other indices and their statistics
  },
  "policies": {
    "<policy_name>": {
      "indices_managed": 10,
      "total_executions": 200,
      "total_successes": 190,
      "total_failures": 10,
      "total_execution_time": "7ms"
    },
    // Other policies and their statistics
  }
}

Note:

  1. Dimension: Cluster, nodes, indices, policies
  2. Target: cumulative or _all, node ids, index names, policy IDs (comma separated values for multiple values)

Pros:

  1. Provides stats at a much more granular level.
  2. We can maybe segregate the levels as policy, indices, cumulative stats to different levels of granularity, alongside the feasibility of _all to return all the stats.

Cons:

  1. The response of this stats framework, if implemented without the levels of granularity, could be huge to process. Might have some unintended affects on the memory of the nodes if the API is not polled judiciously.
  2. We would need to handle scenarios were policies or indices are deleted.