-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
per user index query readiness with limits overrides #5484
Changes from 3 commits
4b80fc0
c8cfe6c
a91145f
e539bfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
package downloads | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
@@ -12,42 +10,19 @@ const ( | |
statusSuccess = "success" | ||
) | ||
|
||
type downloadTableDurationMetric struct { | ||
sync.RWMutex | ||
gauge prometheus.Gauge | ||
periods map[string]float64 | ||
} | ||
|
||
func (m *downloadTableDurationMetric) add(period string, downloadDuration float64) { | ||
m.Lock() | ||
defer m.Unlock() | ||
m.periods[period] = downloadDuration | ||
|
||
totalDuration := float64(0) | ||
for _, dur := range m.periods { | ||
totalDuration += dur | ||
} | ||
|
||
m.gauge.Set(totalDuration) | ||
} | ||
|
||
type metrics struct { | ||
// metrics for measuring performance of downloading of files per period initially i.e for the first time | ||
tablesDownloadDurationSeconds *downloadTableDurationMetric | ||
|
||
queryTimeTableDownloadDurationSeconds *prometheus.CounterVec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if an histogram wouldn't be better here ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if that would add much value. Would we be interested in looking at a distribution? I think it would be rare and we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the PromQL you'll use with this ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. something like |
||
tablesSyncOperationTotal *prometheus.CounterVec | ||
tablesDownloadOperationDurationSeconds prometheus.Gauge | ||
} | ||
|
||
func newMetrics(r prometheus.Registerer) *metrics { | ||
m := &metrics{ | ||
tablesDownloadDurationSeconds: &downloadTableDurationMetric{ | ||
periods: map[string]float64{}, | ||
gauge: promauto.With(r).NewGauge(prometheus.GaugeOpts{ | ||
Namespace: "loki_boltdb_shipper", | ||
Name: "initial_tables_download_duration_seconds", | ||
Help: "Time (in seconds) spent in downloading of files per table, initially i.e for the first time", | ||
})}, | ||
queryTimeTableDownloadDurationSeconds: promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "loki_boltdb_shipper", | ||
Name: "query_time_table_download_duration_seconds", | ||
Help: "Time (in seconds) spent in downloading of files per table at query time", | ||
}, []string{"table"}), | ||
tablesSyncOperationTotal: promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "loki_boltdb_shipper", | ||
Name: "tables_sync_operation_total", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
github.com/grafana/loki/pkg/util/validation
points to a copy of the cortex validation package, which we should clean up sometime.