qdrant / qdrant-client

Python client for Qdrant vector search engine
https://qdrant.tech
Apache License 2.0
673 stars 106 forks source link

qdrant cloud: retrieve collection metrics via python client #638

Closed filipecosta90 closed 3 weeks ago

filipecosta90 commented 3 weeks ago

Wanted to double check if there is a way of retrieving the memory/disk usage for each collection via the python client. I'm finding it hard, even via the API to get this info.

I was only able to retrieve it properly via the undocumented API at cluster level via the metrics endpoint, but this is only valid for 1 collection and I'm also expecting it to include overhead of the system itself -- so, not perfect.

Currently I can get it via:

curl 'https://cloud.qdrant.io/api/v1/accounts/<account id>/clusters/<cluster id>/metrics'

with the sample data bellow:

{
    "nodes": [
        {
            "node_id": "qdrant-87c760c7-213d-420b-a3f1-c5ff4f48afd4-0",
            "cpu": {
                "avg": {
                    "current": "1.2859171573814976",
                    "1": "1.5038854089908655",
                    "3": "1.6912302836250612",
                    "24": "1.285450600137149"
                },
                "total": {
                    "value": "16.0",
                    "unit": "vcpu/core"
                }
            },
            "ram": {
                "avg": {
                    "current": "16492157009.92",
                    "1": "15784657135.458462",
                    "3": "15552328054.491428",
                    "24": "15175489617.92"
                },
                "total": {
                    "value": "137438953472",
                    "unit": "bytes"
                }
            },
            "ram_rss": {
                "avg": {
                    "current": "16422656081.92",
                    "1": "15750153691.766153",
                    "3": "15529118363.062857",
                    "24": "15171270737.92"
                },
                "total": {
                    "value": "137438953472",
                    "unit": "bytes"
                }
            },
            "disk": {
                "avg": {
                    "current": "852148224.0",
                    "1": "393330057.84615386",
                    "3": "243511881.14285713",
                    "24": "57344.0"
                },
                "total": {
                    "value": "549755813888",
                    "unit": "bytes"
                }
            }
        },
        {
            "node_id": "qdrant-87c760c7-213d-420b-a3f1-c5ff4f48afd4-1",
            "cpu": {
                "avg": {
                    "current": "1.283758001276242",
                    "1": "1.3981456994494512",
                    "3": "1.4964670337601391",
                    "24": "1.2836337429098768"
                },
                "total": {
                    "value": "16.0",
                    "unit": "vcpu/core"
                }
            },
            "ram": {
                "avg": {
                    "current": "16317880401.92",
                    "1": "15703150516.381538",
                    "3": "15501643565.348572",
                    "24": "15175055441.92"
                },
                "total": {
                    "value": "137438953472",
                    "unit": "bytes"
                }
            },
            "ram_rss": {
                "avg": {
                    "current": "16253425745.92",
                    "1": "15670976436.381538",
                    "3": "15479801352.777143",
                    "24": "15170730065.92"
                },
                "total": {
                    "value": "137438953472",
                    "unit": "bytes"
                }
            },
            "disk": {
                "avg": {
                    "current": "782372864.0",
                    "1": "366799635.6923077",
                    "3": "234112731.42857143",
                    "24": "57344.0"
                },
                "total": {
                    "value": "549755813888",
                    "unit": "bytes"
                }
            }
        },
        {
            "node_id": "qdrant-87c760c7-213d-420b-a3f1-c5ff4f48afd4-2",
            "cpu": {
                "avg": {
                    "current": "1.2841290958888705",
                    "1": "1.3490270654217091",
                    "3": "1.404827823006273",
                    "24": "1.2840706468315952"
                },
                "total": {
                    "value": "16.0",
                    "unit": "vcpu/core"
                }
            },
            "ram": {
                "avg": {
                    "current": "16417093713.92",
                    "1": "15748785312.68923",
                    "3": "15530089700.205715",
                    "24": "15174608977.92"
                },
                "total": {
                    "value": "137438953472",
                    "unit": "bytes"
                }
            },
            "ram_rss": {
                "avg": {
                    "current": "16357775441.92",
                    "1": "15719158629.612309",
                    "3": "15509924507.062857",
                    "24": "15170594897.92"
                },
                "total": {
                    "value": "137438953472",
                    "unit": "bytes"
                }
            },
            "disk": {
                "avg": {
                    "current": "737804288.0",
                    "1": "340555933.53846157",
                    "3": "210842185.14285713",
                    "24": "57344.0"
                },
                "total": {
                    "value": "549755813888",
                    "unit": "bytes"
                }
            }
        }
    ]
}
joein commented 3 weeks ago

Hi @filipecosta90 no, there is no way to retrieve this kind of information.

Those metrics are collected by the cloud tools, rather than by Qdrant itself, there is no way to reach them via client.