-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added spoolman metrics #23
base: main
Are you sure you want to change the base?
Conversation
I also use Spoolman with my Klipper install so I will give this a test and provide any feedback. |
type mismatch
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.
- Add comments where highlighted for consistency
- Add
spoolman
entry in example configexample/prometheus.yml
- Update the table with the list of supported metrics in the Modules section of README.md
- I suggest adding a short section in the README.md specifically covering how the klipper spoolman metrics can be used in conjunction with the spoolman metrics (Added prometheus integration Donkie/Spoolman#350)
@@ -34,6 +35,13 @@ func getValidLabelName(str string) string { | |||
return prometheusMetricNameInvalidCharactersRegex.ReplaceAllString(strings.Replace(str, "-", "_", -1), "") | |||
} | |||
|
|||
func b2f(cond bool) float64 { |
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.
Add a comment before the function definition to explain its purpose (i.e. convert bool to float value)
@@ -533,6 +541,23 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) { | |||
pinName) | |||
} | |||
} | |||
|
|||
if slices.Contains(c.modules, "spoolman") { |
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.
Add a comment line // Spoolman
for consistency to other code sections above
@@ -0,0 +1,55 @@ | |||
package collector | |||
|
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.
Add a comment with a link to the relevant section of the moonraker docs
i.e. // https://moonraker.readthedocs.io/en/latest/web_api/#spoolman-apis
Added metrics from Spoolman module, such as current spool ID and connected status&