def get_index_stats(self, marqo_index: MarqoIndex) -> MarqoIndexStats:
        """
        Get statistics for a Marqo index.
        Args:
            marqo_index: Marqo index to get statistics for

        Returns:
            Marqo index statistics
        """
        vespa_index = vespa_index_factory(marqo_index)

        doc_count_query_result = self.vespa_client.query(
            yql=f'select * from {marqo_index.schema_name} where true limit 0',
            model_restrict=marqo_index.schema_name
        )
        vector_count_query_result = self.vespa_client.query(
            **vespa_index.get_vector_count_query()
        )

        try:
            if vector_count_query_result.root.children[0].children is None:  # empty index
                number_of_vectors = 0
            else:
                number_of_vectors = list(
                    vector_count_query_result.root.children[0].children[0].children[0].fields.values()
                )[0]
        except (TypeError, AttributeError, IndexError) as e:
            raise InternalError(f"Failed to get the number of vectors for index {marqo_index.name}: {e}") from e

        metrics = self.vespa_client.get_metrics()

        memory_utilization = metrics.clusterController_resourceUsage_maxMemoryUtilization_max
        disk_utilization = metrics.clusterController_resourceUsage_maxDiskUtilization_max

        # Occasionally Vespa returns empty metrics, often for the first call after a restart
        if memory_utilization is None:
            logger.warning(f'Vespa did not return a value for memory utilization metrics')
        if disk_utilization is None:
            logger.warning(f'Vespa did not return a value for disk utilization metrics')

        return MarqoIndexStats(
            number_of_documents=doc_count_query_result.total_count,
            number_of_vectors=number_of_vectors,
            backend=VespaStats(
                memory_used_percentage=memory_utilization * 100 if memory_utilization is not None else None,
                storage_used_percentage=disk_utilization * 100 if disk_utilization is not None else None
            )
        )

        Get statistics for a Marqo index.
        Args:
            marqo_index: Marqo index to get statistics for

        Returns:
            Marqo index statistics
        
src/marqo/core/monitoring/monitoring.py