Skip to content
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

Add missing zheight metric #100

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions prusalink/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Collector struct {
printerNozzleSize *prometheus.Desc
printerStatus *prometheus.Desc
printerAxis *prometheus.Desc
printerZHeight *prometheus.Desc
printerFlow *prometheus.Desc
printerInfo *prometheus.Desc
printerMMU *prometheus.Desc
Expand Down Expand Up @@ -62,6 +63,7 @@ func NewCollector(config config.Config) *Collector {
printerNozzleSize: prometheus.NewDesc("prusa_nozzle_size", "Returns information about selected nozzle size.", defaultLabels, nil),
printerStatus: prometheus.NewDesc("prusa_status", "Returns information status of printer.", append(defaultLabels, "printer_state"), nil),
printerAxis: prometheus.NewDesc("prusa_axis", "Returns information about position of axis.", append(defaultLabels, "printer_axis"), nil),
printerZHeight: prometheus.NewDesc("prusa_z_height_meters", "Returns information about current height of Z axis.", defaultLabels, nil),
printerFlow: prometheus.NewDesc("prusa_print_flow_ratio", "Returns information about of filament flow in ratio (0.0 - 1.0).", defaultLabels, nil),
printerInfo: prometheus.NewDesc("prusa_info", "Returns information about printer.", append(defaultLabels, "api_version", "server_version", "version_text", "prusalink_name", "printer_location", "serial_number", "printer_hostname"), nil),
printerMMU: prometheus.NewDesc("prusa_mmu", "Returns information if MMU is enabled.", defaultLabels, nil),
Expand Down Expand Up @@ -100,6 +102,7 @@ func (collector *Collector) Describe(ch chan<- *prometheus.Desc) {
ch <- collector.printerNozzleSize
ch <- collector.printerStatus
ch <- collector.printerAxis
ch <- collector.printerZHeight
ch <- collector.printerFlow
ch <- collector.printerInfo
ch <- collector.printerMMU
Expand Down Expand Up @@ -309,6 +312,13 @@ func (collector *Collector) Collect(ch chan<- prometheus.Metric) {

ch <- printerAxisZ

printerZHeight := prometheus.MustNewConstMetric(
collector.printerZHeight, prometheus.GaugeValue,
printer.Telemetry.ZHeight/1000,
GetLabels(s, job)...)

ch <- printerZHeight

printerFlow := prometheus.MustNewConstMetric(collector.printerFlow, prometheus.GaugeValue,
status.Printer.Flow/100, GetLabels(s, job)...)

Expand Down