fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

queue: remove duplicative index_state_count prometheus metric (#233)

+7 -21
+7 -21
cmd/zoekt-sourcegraph-indexserver/queue.go
··· 132 132 func (q *Queue) SetIndexed(opts IndexOptions, state indexState) { 133 133 q.mu.Lock() 134 134 item := q.get(opts.RepoID) 135 - item.setIndexState(state) 135 + 136 + item.indexState = state 136 137 if state != indexStateFail { 137 138 item.indexed = reflect.DeepEqual(opts, item.opts) 138 139 } 140 + 139 141 if item.heapIdx >= 0 { 140 142 // We only update the position in the queue, never add it. 141 143 heap.Fix(&q.pq, item.heapIdx) 142 144 } 145 + 143 146 q.mu.Unlock() 144 147 } 145 148 ··· 179 182 if item.heapIdx >= 0 { 180 183 heap.Remove(&q.pq, item.heapIdx) 181 184 } 182 - item.setIndexState("") 185 + 186 + item.indexState = "" 187 + 183 188 delete(q.items, item.opts.RepoID) 184 189 count++ 185 190 } ··· 216 221 q.pq = make(pqueue, 0) 217 222 } 218 223 219 - // setIndexedState will set indexedState and update the corresponding metrics 220 - // if the state is changing. 221 - func (item *queueItem) setIndexState(state indexState) { 222 - if state == item.indexState { 223 - return 224 - } 225 - if item.indexState != "" { 226 - metricIndexState.WithLabelValues(string(item.indexState)).Dec() 227 - } 228 - item.indexState = state 229 - if item.indexState != "" { 230 - metricIndexState.WithLabelValues(string(item.indexState)).Inc() 231 - } 232 - } 233 - 234 224 // pqueue implements a priority queue via the interface for container/heap 235 225 type pqueue []*queueItem 236 226 ··· 286 276 Name: "index_queue_cap", 287 277 Help: "The number of repositories tracked by the index queue, including popped items. Should be the same as index_num_assigned.", 288 278 }) 289 - metricIndexState = promauto.NewGaugeVec(prometheus.GaugeOpts{ 290 - Name: "index_state_count", 291 - Help: "The count of repositories per the state of the last index.", 292 - }, []string{"state"}) 293 279 )