Skip to content

Commit

Permalink
Chore/value layer condiction (#2)
Browse files Browse the repository at this point in the history
* Current file print and xyz position

* add entity

* check Condicion Status Print
  • Loading branch information
danilodorgam authored Apr 8, 2023
1 parent f8cac99 commit 0068875
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,22 +517,29 @@ func (c collector) CollectCurrentPrint(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc("klipper_current_print_object_height", "Current print Object Height", nil, nil),
prometheus.GaugeValue,
result.Result.Jobs[0].Metadata.ObjectHeight,
c.checkCondicionStatusPrint(result, result.Result.Jobs[0].Metadata.ObjectHeight),
)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc("klipper_current_print_first_layer_height", "Current print First Layer Height", nil, nil),
prometheus.GaugeValue,
result.Result.Jobs[0].Metadata.FirstLayerHeight,
c.checkCondicionStatusPrint(result, result.Result.Jobs[0].Metadata.FirstLayerHeight),
)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc("klipper_current_print_layer_height", "Current print Layer Height", nil, nil),
prometheus.GaugeValue,
result.Result.Jobs[0].Metadata.LayerHeight,
c.checkCondicionStatusPrint(result, result.Result.Jobs[0].Metadata.LayerHeight),
)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc("klipper_current_print_total_duration", "Current print Total Duration", nil, nil),
prometheus.GaugeValue,
result.Result.Jobs[0].TotalDuration,
c.checkCondicionStatusPrint(result, result.Result.Jobs[0].TotalDuration),
)

}
func (c collector) checkCondicionStatusPrint(result *MoonrakerHistoryCurrentPrintResponse, value float64) float64 {
var valueToReturn float64 = 0
if result.Result.Jobs[0].Status == "in_progress" {
valueToReturn = value
}
return valueToReturn
}

0 comments on commit 0068875

Please sign in to comment.