Skip to content

Introduce grey collection status and expose shard status in telemetry - #4940

Merged
KShivendu merged 20 commits into
devfrom
expose-shard-status
Sep 5, 2024
Merged

KShivendu merged 20 commits into
devfrom
expose-shard-status

Conversation

@KShivendu

@KShivendu KShivendu commented Aug 22, 2024 •

Copy link
Copy Markdown
Member

Introduces a status field in telemetry response for each of the local shard. It will have same possible values as the collection status (green, yellow, grey, red). So shard telemetry will look like:

{
    "shards": [
        {
            "id": 0,
            "local": {
                "variant_name": "local shard",
                "status": "green", // --------------------> new addition
                "segments": [ "..." ],
                "optimizations": {
                    "status": "ok",
                    "optimizations": {
                        "count": 0,
                        "total_duration_micros": 0,
                        "last_responded": "2024-08-23T08:57:39.410Z"
                    },
                    "log": []
                }
            },
            "remote": [],
            "replicate_states": {
                "2762498644323566": "Active"
            }
        }
    ],
    "transfers": []
}

This feature will be used to assess if a replica is indexed enough.

This PR does the following:

  • Introduces the grey collection status that was supposed to be released with v1.10. It means that shard is available, but some segments have pending optimization.
  • Renames CollectionInfoInternal to ShardInfoInternal to better represent that the struct represents shard level data. The same struct is eventually used to build CollectionInfo which is exposed by the APIs.
  • Introduces a dedicated ShardStatus to be used in shard telemetry. This is also converted into CollectionStatus when representating collection status (say for /collection/<collection> API)

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

@KShivendu
KShivendu marked this pull request as draft August 22, 2024 17:49
@KShivendu
KShivendu marked this pull request as ready for review August 23, 2024 08:36
@KShivendu
KShivendu requested review from ffuugoo, generall and timvisee and removed request for ffuugoo August 23, 2024 08:37
Comment thread lib/collection/src/operations/types.rs Resolved
@KShivendu
KShivendu requested review from generall and timvisee August 30, 2024 09:40
Comment on lines +68 to +72
Shard::Local(local_shard) => {
let mut shard_telemetry = local_shard.get_telemetry_data(detail);
shard_telemetry.status = Some(local_shard.local_shard_info().await.status);
shard_telemetry
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only do it this way because we want to expose the status to cluster manager, am I right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks kinda ugly... 😬

I'd add a comment explaining why is it structured like this (e.g., why not just move local_shard_info inside get_telemetry_data).

@ffuugoo ffuugoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a very minor comments. Good job, @KShivendu! 👍

Comment thread lib/collection/src/operations/types.rs Resolved
Comment on lines +68 to +72
Shard::Local(local_shard) => {
let mut shard_telemetry = local_shard.get_telemetry_data(detail);
shard_telemetry.status = Some(local_shard.local_shard_info().await.status);
shard_telemetry
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks kinda ugly... 😬

I'd add a comment explaining why is it structured like this (e.g., why not just move local_shard_info inside get_telemetry_data).

@KShivendu KShivendu changed the title Expose shard status in telemetry Introduce grey collection status and expose shard status in telemetry Sep 4, 2024
Comment thread lib/collection/src/operations/types.rs Resolved
@KShivendu
KShivendu merged commit ed4f209 into dev Sep 5, 2024
@KShivendu
KShivendu deleted the expose-shard-status branch September 5, 2024 07:38
@timvisee timvisee mentioned this pull request Sep 10, 2024
7 tasks done
timvisee pushed a commit that referenced this pull request Sep 17, 2024
…#4940)

* Expose shard status in telemetry API

* fmt

* Drop segment lock before using async fetching shard status

* Use Self in From implementation for ShardStatus to CollectionStatus mapping

* Improve comments

* Remove redundant clone

* Update openapi specs

* Isolate function for shard status

* Fix compiler error

* Avoid adding dedicated function for shard status

* review fixes

* define missing var

* lint err

* comment

* comment

* refactor

* improve comments

* Improve comments

* fix lint and update openapi specs

* improve comment
@timvisee timvisee mentioned this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants