(bucketClient objstore.Bucket, registerer prometheus.Registerer)
| 725 | } |
| 726 | |
| 727 | func newTSDBState(bucketClient objstore.Bucket, registerer prometheus.Registerer) TSDBState { |
| 728 | idleTsdbChecks := promauto.With(registerer).NewCounterVec(prometheus.CounterOpts{ |
| 729 | Name: "cortex_ingester_idle_tsdb_checks_total", |
| 730 | Help: "The total number of various results for idle TSDB checks.", |
| 731 | }, []string{"result"}) |
| 732 | |
| 733 | idleTsdbChecks.WithLabelValues(string(tsdbShippingDisabled)) |
| 734 | idleTsdbChecks.WithLabelValues(string(tsdbNotIdle)) |
| 735 | idleTsdbChecks.WithLabelValues(string(tsdbNotCompacted)) |
| 736 | idleTsdbChecks.WithLabelValues(string(tsdbNotShipped)) |
| 737 | idleTsdbChecks.WithLabelValues(string(tsdbCheckFailed)) |
| 738 | idleTsdbChecks.WithLabelValues(string(tsdbCloseFailed)) |
| 739 | idleTsdbChecks.WithLabelValues(string(tsdbNotActive)) |
| 740 | idleTsdbChecks.WithLabelValues(string(tsdbDataRemovalFailed)) |
| 741 | idleTsdbChecks.WithLabelValues(string(tsdbTenantMarkedForDeletion)) |
| 742 | idleTsdbChecks.WithLabelValues(string(tsdbIdleClosed)) |
| 743 | |
| 744 | return TSDBState{ |
| 745 | dbs: make(map[string]*userTSDB), |
| 746 | bucket: bucketClient, |
| 747 | tsdbMetrics: newTSDBMetrics(registerer), |
| 748 | forceCompactTrigger: make(chan requestWithUsersAndCallback), |
| 749 | shipTrigger: make(chan requestWithUsersAndCallback), |
| 750 | |
| 751 | compactionsTriggered: promauto.With(registerer).NewCounter(prometheus.CounterOpts{ |
| 752 | Name: "cortex_ingester_tsdb_compactions_triggered_total", |
| 753 | Help: "Total number of triggered compactions.", |
| 754 | }), |
| 755 | |
| 756 | compactionsFailed: promauto.With(registerer).NewCounter(prometheus.CounterOpts{ |
| 757 | Name: "cortex_ingester_tsdb_compactions_failed_total", |
| 758 | Help: "Total number of compactions that failed.", |
| 759 | }), |
| 760 | walReplayTime: promauto.With(registerer).NewHistogram(prometheus.HistogramOpts{ |
| 761 | Name: "cortex_ingester_tsdb_wal_replay_duration_seconds", |
| 762 | Help: "The total time it takes to open and replay a TSDB WAL.", |
| 763 | Buckets: prometheus.DefBuckets, |
| 764 | }), |
| 765 | appenderAddDuration: promauto.With(registerer).NewHistogram(prometheus.HistogramOpts{ |
| 766 | Name: "cortex_ingester_tsdb_appender_add_duration_seconds", |
| 767 | Help: "The total time it takes for a push request to add samples to the TSDB appender.", |
| 768 | Buckets: []float64{.001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}, |
| 769 | }), |
| 770 | appenderCommitDuration: promauto.With(registerer).NewHistogram(prometheus.HistogramOpts{ |
| 771 | Name: "cortex_ingester_tsdb_appender_commit_duration_seconds", |
| 772 | Help: "The total time it takes for a push request to commit samples appended to TSDB.", |
| 773 | Buckets: []float64{.001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}, |
| 774 | }), |
| 775 | |
| 776 | idleTsdbChecks: idleTsdbChecks, |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | // New returns a new Ingester that uses Cortex block storage instead of chunks storage. |
| 781 | func New(cfg Config, limits *validation.Overrides, registerer prometheus.Registerer, logger log.Logger, resourceMonitor *resource.Monitor) (*Ingester, error) { |
no test coverage detected