Skip to content

Commit

Permalink
chunk lifespan histogram (#1958)
Browse files Browse the repository at this point in the history
* chunk lifespan histogram

* renames to bounds for clarity
  • Loading branch information
owen-d authored Apr 17, 2020
1 parent 2078a7d commit 8b924a5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/ingester/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ var (
Name: "ingester_chunks_flushed_total",
Help: "Total flushed chunks per reason.",
}, []string{"reason"})
chunkLifespan = promauto.NewHistogram(prometheus.HistogramOpts{
Namespace: "loki",
Name: "ingester_chunk_bounds_minutes",
Help: "Distribution of chunk end-start durations.",
// 15m to 2h
Buckets: prometheus.LinearBuckets(15, 15, 8),
})
)

const (
Expand Down Expand Up @@ -353,8 +360,9 @@ func (i *Ingester) flushChunks(ctx context.Context, fp model.Fingerprint, labelP
chunkSize.Observe(compressedSize)
sizePerTenant.Add(compressedSize)
countPerTenant.Inc()
firstTime, _ := cs[i].chunk.Bounds()
firstTime, lastTime := cs[i].chunk.Bounds()
chunkAge.Observe(time.Since(firstTime).Seconds())
chunkLifespan.Observe(lastTime.Sub(firstTime).Minutes())
}

return nil
Expand Down

0 comments on commit 8b924a5

Please sign in to comment.