|
| 1 | +from sentry_sdk.integrations.qdrant.path_matching import PathTrie |
| 2 | + |
| 3 | +SPAN_ORIGIN = "auto.db.qdrant" |
| 4 | + |
| 5 | +# created from https://github.com/qdrant/qdrant/blob/master/docs/redoc/v1.11.x/openapi.json |
| 6 | +# only used for qdrants REST API. gRPC is using other identifiers |
| 7 | +_PATH_TO_OPERATION_ID = { |
| 8 | + "/collections/{collection_name}/shards": {"put": "create_shard_key"}, |
| 9 | + "/collections/{collection_name}/shards/delete": {"post": "delete_shard_key"}, |
| 10 | + "/": {"get": "root"}, |
| 11 | + "/telemetry": {"get": "telemetry"}, |
| 12 | + "/metrics": {"get": "metrics"}, |
| 13 | + "/locks": {"post": "post_locks", "get": "get_locks"}, |
| 14 | + "/healthz": {"get": "healthz"}, |
| 15 | + "/livez": {"get": "livez"}, |
| 16 | + "/readyz": {"get": "readyz"}, |
| 17 | + "/issues": {"get": "get_issues", "delete": "clear_issues"}, |
| 18 | + "/cluster": {"get": "cluster_status"}, |
| 19 | + "/cluster/recover": {"post": "recover_current_peer"}, |
| 20 | + "/cluster/peer/{peer_id}": {"delete": "remove_peer"}, |
| 21 | + "/collections": {"get": "get_collections"}, |
| 22 | + "/collections/{collection_name}": { |
| 23 | + "get": "get_collection", |
| 24 | + "put": "create_collection", |
| 25 | + "patch": "update_collection", |
| 26 | + "delete": "delete_collection", |
| 27 | + }, |
| 28 | + "/collections/aliases": {"post": "update_aliases"}, |
| 29 | + "/collections/{collection_name}/index": {"put": "create_field_index"}, |
| 30 | + "/collections/{collection_name}/exists": {"get": "collection_exists"}, |
| 31 | + "/collections/{collection_name}/index/{field_name}": { |
| 32 | + "delete": "delete_field_index" |
| 33 | + }, |
| 34 | + "/collections/{collection_name}/cluster": { |
| 35 | + "get": "collection_cluster_info", |
| 36 | + "post": "update_collection_cluster", |
| 37 | + }, |
| 38 | + "/collections/{collection_name}/aliases": {"get": "get_collection_aliases"}, |
| 39 | + "/aliases": {"get": "get_collections_aliases"}, |
| 40 | + "/collections/{collection_name}/snapshots/upload": { |
| 41 | + "post": "recover_from_uploaded_snapshot" |
| 42 | + }, |
| 43 | + "/collections/{collection_name}/snapshots/recover": { |
| 44 | + "put": "recover_from_snapshot" |
| 45 | + }, |
| 46 | + "/collections/{collection_name}/snapshots": { |
| 47 | + "get": "list_snapshots", |
| 48 | + "post": "create_snapshot", |
| 49 | + }, |
| 50 | + "/collections/{collection_name}/snapshots/{snapshot_name}": { |
| 51 | + "delete": "delete_snapshot", |
| 52 | + "get": "get_snapshot", |
| 53 | + }, |
| 54 | + "/snapshots": {"get": "list_full_snapshots", "post": "create_full_snapshot"}, |
| 55 | + "/snapshots/{snapshot_name}": { |
| 56 | + "delete": "delete_full_snapshot", |
| 57 | + "get": "get_full_snapshot", |
| 58 | + }, |
| 59 | + "/collections/{collection_name}/shards/{shard_id}/snapshots/upload": { |
| 60 | + "post": "recover_shard_from_uploaded_snapshot" |
| 61 | + }, |
| 62 | + "/collections/{collection_name}/shards/{shard_id}/snapshots/recover": { |
| 63 | + "put": "recover_shard_from_snapshot" |
| 64 | + }, |
| 65 | + "/collections/{collection_name}/shards/{shard_id}/snapshots": { |
| 66 | + "get": "list_shard_snapshots", |
| 67 | + "post": "create_shard_snapshot", |
| 68 | + }, |
| 69 | + "/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}": { |
| 70 | + "delete": "delete_shard_snapshot", |
| 71 | + "get": "get_shard_snapshot", |
| 72 | + }, |
| 73 | + "/collections/{collection_name}/points/{id}": {"get": "get_point"}, |
| 74 | + "/collections/{collection_name}/points": { |
| 75 | + "post": "get_points", |
| 76 | + "put": "upsert_points", |
| 77 | + }, |
| 78 | + "/collections/{collection_name}/points/delete": {"post": "delete_points"}, |
| 79 | + "/collections/{collection_name}/points/vectors": {"put": "update_vectors"}, |
| 80 | + "/collections/{collection_name}/points/vectors/delete": {"post": "delete_vectors"}, |
| 81 | + "/collections/{collection_name}/points/payload": { |
| 82 | + "post": "set_payload", |
| 83 | + "put": "overwrite_payload", |
| 84 | + }, |
| 85 | + "/collections/{collection_name}/points/payload/delete": {"post": "delete_payload"}, |
| 86 | + "/collections/{collection_name}/points/payload/clear": {"post": "clear_payload"}, |
| 87 | + "/collections/{collection_name}/points/batch": {"post": "batch_update"}, |
| 88 | + "/collections/{collection_name}/points/scroll": {"post": "scroll_points"}, |
| 89 | + "/collections/{collection_name}/points/search": {"post": "search_points"}, |
| 90 | + "/collections/{collection_name}/points/search/batch": { |
| 91 | + "post": "search_batch_points" |
| 92 | + }, |
| 93 | + "/collections/{collection_name}/points/search/groups": { |
| 94 | + "post": "search_point_groups" |
| 95 | + }, |
| 96 | + "/collections/{collection_name}/points/recommend": {"post": "recommend_points"}, |
| 97 | + "/collections/{collection_name}/points/recommend/batch": { |
| 98 | + "post": "recommend_batch_points" |
| 99 | + }, |
| 100 | + "/collections/{collection_name}/points/recommend/groups": { |
| 101 | + "post": "recommend_point_groups" |
| 102 | + }, |
| 103 | + "/collections/{collection_name}/points/discover": {"post": "discover_points"}, |
| 104 | + "/collections/{collection_name}/points/discover/batch": { |
| 105 | + "post": "discover_batch_points" |
| 106 | + }, |
| 107 | + "/collections/{collection_name}/points/count": {"post": "count_points"}, |
| 108 | + "/collections/{collection_name}/points/query": {"post": "query_points"}, |
| 109 | + "/collections/{collection_name}/points/query/batch": {"post": "query_batch_points"}, |
| 110 | + "/collections/{collection_name}/points/query/groups": { |
| 111 | + "post": "query_points_groups" |
| 112 | + }, |
| 113 | +} |
| 114 | + |
| 115 | +_DISALLOWED_PROTO_FIELDS = {"data", "keyword"} |
| 116 | + |
| 117 | +_DISALLOWED_REST_FIELDS = {"nearest", "value"} |
| 118 | + |
| 119 | +_IDENTIFIER = "qdrant" |
| 120 | + |
| 121 | +_qdrant_trie = PathTrie(_PATH_TO_OPERATION_ID) |
0 commit comments