open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.11k stars 2.39k forks source link

Add shard count to the Elasticsearch index stats scrapper #35858

Open nathan-maves opened 1 month ago

nathan-maves commented 1 month ago

Component(s)

receiver/elasticsearch

Is your feature request related to a problem? Please describe.

I was trying to be able to compare 3 dimensions of Elasticsearch index stats document count, shards size and shard count but this receiver only scapes 2 of the 3 from the /_stats endpoint.

Describe the solution you'd like

Add the shard count to the collected metrics for each index. The /users/_stats endpoint contains the total_count for shards.

{
  "_shards": {
    "total": 6,
    "successful": 6,
    "failed": 0
  },
  "_all": {
    "primaries": {
      "docs": {
        "count": 599007114,
        "deleted": 6255158,
        "total_size_in_bytes": 106202644463
      },
      "shard_stats": {
        "total_count": 3
      }
    },
    "total": {
      "docs": {
        "count": 1198014228,
        "deleted": 12506844,
        "total_size_in_bytes": 212356147240
      },
      "shard_stats": {
        "total_count": 6
      }
    }
  },
  "indices": {
    "users": {
      "uuid": "6UqMYhVwS4OwyngTqKG8ow",
      "health": "green",
      "status": "open",
      "primaries": {
        "docs": {
          "count": 599007114,
          "deleted": 6255158,
          "total_size_in_bytes": 106202644463
        },
        "shard_stats": {
          "total_count": 3
        }
      },
      "total": {
        "docs": {
          "count": 1198014228,
          "deleted": 12506844,
          "total_size_in_bytes": 212356147240
        },
        "shard_stats": {
          "total_count": 6
        }
      }
    }
  }
}

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 1 month ago

Pinging code owners: