github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/hnsw/insert_metrics.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package hnsw 13 14 type insertMetrics struct { 15 total Observer 16 prepareAndInsertNode Observer 17 findEntrypoint Observer 18 updateGlobalEntrypoint Observer 19 findAndConnectTotal Observer 20 findAndConnectSearch Observer 21 findAndConnectHeuristic Observer 22 findAndConnectUpdateConnections Observer 23 } 24 25 // newInsertMetrics curries the prometheus observers just once at creation time 26 // and therefore avoids having to make a lot of allocations on the hot path 27 func newInsertMetrics(metrics *Metrics) *insertMetrics { 28 return &insertMetrics{ 29 total: metrics.TrackInsertObserver("total"), 30 prepareAndInsertNode: metrics.TrackInsertObserver("prepare_and_insert_node"), 31 findEntrypoint: metrics.TrackInsertObserver("find_entrypoint"), 32 updateGlobalEntrypoint: metrics.TrackInsertObserver("update_global_entrypoint"), 33 findAndConnectTotal: metrics.TrackInsertObserver("find_and_connect_total"), 34 findAndConnectSearch: metrics.TrackInsertObserver("find_and_connect_search"), 35 findAndConnectHeuristic: metrics.TrackInsertObserver("find_and_connect_heuristic"), 36 findAndConnectUpdateConnections: metrics.TrackInsertObserver("find_and_connect_update_connections"), 37 } 38 }