Search poc: Add debug log for metric and update metric buckets (#95217)

* adds debug log for metric

* updates buckets
This commit is contained in:
owensmallwood 2024-10-23 01:35:17 -06:00 committed by GitHub
parent b189743ca0
commit d9bc4f7395
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -53,7 +53,7 @@ func (i *Index) IndexBatch(list *ListResponse, kind string) error {
if err != nil {
return err
}
i.log.Debug("initial indexing resources batch", "count", len(list.Items), "kind", kind, "tenant", res.Namespace)
i.log.Debug("indexing resource in batch", "batch_count", len(list.Items), "kind", kind, "tenant", res.Namespace)
// Transform the raw resource into a more generic indexable resource
indexableResource, err := NewIndexedResource(obj.Value)
@ -88,6 +88,7 @@ func (i *Index) Init(ctx context.Context) error {
// Paginate through the list of resources and index each page
for {
i.log.Debug("fetching resource list", "kind", rt.Key.Resource)
list, err := i.s.List(ctx, r)
if err != nil {
return err
@ -108,6 +109,7 @@ func (i *Index) Init(ctx context.Context) error {
}
end := time.Now().Unix()
i.log.Debug("Initial indexing finished", "seconds", float64(end-start))
if IndexServerMetrics != nil {
IndexServerMetrics.IndexCreationTime.WithLabelValues().Observe(float64(end - start))
}

View File

@ -26,7 +26,7 @@ type IndexMetrics struct {
IndexCreationTime *prometheus.HistogramVec
}
var IndexCreationBuckets = []float64{1, 5, 10, 25, 50, 75, 100, 150, 200, 250, 300}
var IndexCreationBuckets = []float64{1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000}
func NewIndexMetrics(indexDir string, indexServer *IndexServer) *IndexMetrics {
onceIndex.Do(func() {