-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some metrics for monitoring compactor (#2548)
- Loading branch information
1 parent
4f6a4c2
commit 1bba2a8
Showing
3 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package compactor | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
const ( | ||
statusFailure = "failure" | ||
statusSuccess = "success" | ||
) | ||
|
||
type metrics struct { | ||
compactTablesOperationTotal *prometheus.CounterVec | ||
compactTablesOperationDurationSeconds prometheus.Gauge | ||
} | ||
|
||
func newMetrics(r prometheus.Registerer) *metrics { | ||
m := metrics{ | ||
compactTablesOperationTotal: promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "loki_boltdb_shipper", | ||
Name: "compact_tables_operation_total", | ||
Help: "Total number of tables compaction done by status", | ||
}, []string{"status"}), | ||
compactTablesOperationDurationSeconds: promauto.With(r).NewGauge(prometheus.GaugeOpts{ | ||
Namespace: "loki_boltdb_shipper", | ||
Name: "compact_tables_operation_duration_seconds", | ||
Help: "Time (in seconds) spent in compacting all the tables", | ||
}), | ||
} | ||
|
||
return &m | ||
} |