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

Added spoolman metrics #23

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Forest-Troll
Copy link

Added metrics from Spoolman module, such as current spool ID and connected status&

@scross01 scross01 added the enhancement New feature or request label Apr 9, 2024
@scross01
Copy link
Owner

scross01 commented Apr 9, 2024

I also use Spoolman with my Klipper install so I will give this a test and provide any feedback.

@Forest-Troll
Copy link
Author

I have already do PR to Spoolman with simillar feature. For both it view as:

Снимок экрана 2024-04-09 в 16 10 08

type mismatch
Copy link
Owner

@scross01 scross01 left a 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 config example/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 {
Copy link
Owner

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") {
Copy link
Owner

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

Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants