-
-
Notifications
You must be signed in to change notification settings - Fork 44
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 options for History and Wanted/Missing queries skip, remove sort on Wanted/Missing #299
base: master
Are you sure you want to change the base?
Conversation
…on Wanted/Missing query
internal/arr/config/arr.go
Outdated
flags.Bool("skip-history", false, "Skip History metrics query") | ||
flags.Bool("skip-missing", false, "Skip Wanted/Missing metrics query") |
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.
Tabs
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.
I've never used go and I'm a "spaces not tabs" person so I was unaware of the standard or that I had done it differently than yours. I ran it through gofmt, given that's the official tool I'd imagine that's your expectation. Let me know if it needs anything else.
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.
I am also a spaces person as well, but Go has some opinions on formatting that I like to follow.
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.
Wholeheartedly agree -- if the language has a suggested standard, use it.
Changes appear good here, but I wonder if it could be added to the logic Also @rtrox would be great if/when you are free to review to get a pair of second eyes on this. |
Thanks for the PR @codefaux! Sorry about the delayed review here, been dealing with some issues in RL. A few comments, but overall looks good! |
"error", err) | ||
ch <- prometheus.NewInvalidMetric(collector.errorMetric, err) | ||
return | ||
if collector.config.EnableAdditionalMetrics { |
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.
Given we're blocking the whole collector, can we instead put this in the Commands
file, and just not register the collector?
exportarr/internal/commands/arr.go
Lines 44 to 67 in 72c2d6c
var radarrCmd = &cobra.Command{ | |
Use: "radarr", | |
Aliases: []string{"r"}, | |
Short: "Prometheus Exporter for Radarr", | |
Long: "Prometheus Exporter for Radarr.", | |
RunE: func(cmd *cobra.Command, args []string) error { | |
c, err := config.LoadArrConfig(*conf, cmd.PersistentFlags()) | |
if err != nil { | |
return err | |
} | |
c.ApiVersion = "v3" | |
UsageOnError(cmd, c.Validate()) | |
serveHttp(func(r prometheus.Registerer) { | |
r.MustRegister( | |
collector.NewRadarrCollector(c), | |
collector.NewQueueCollector(c), | |
collector.NewHistoryCollector(c), | |
collector.NewRootFolderCollector(c), | |
collector.NewSystemStatusCollector(c), | |
collector.NewSystemHealthCollector(c), | |
) | |
}) | |
return nil |
The same config is available there as c
, so you can just check c.EnableAdditionalMetrics
.
@@ -197,21 +197,21 @@ func (collector *lidarrCollector) Collect(ch chan<- prometheus.Metric) { | |||
albumGenres[genre]++ | |||
} | |||
} | |||
albumsMissing := model.Missing{} |
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.
For Radarr & Readarr, we divine this metric instead of sending a separate call for it:
exportarr/internal/commands/arr.go
Lines 44 to 67 in 72c2d6c
var radarrCmd = &cobra.Command{ | |
Use: "radarr", | |
Aliases: []string{"r"}, | |
Short: "Prometheus Exporter for Radarr", | |
Long: "Prometheus Exporter for Radarr.", | |
RunE: func(cmd *cobra.Command, args []string) error { | |
c, err := config.LoadArrConfig(*conf, cmd.PersistentFlags()) | |
if err != nil { | |
return err | |
} | |
c.ApiVersion = "v3" | |
UsageOnError(cmd, c.Validate()) | |
serveHttp(func(r prometheus.Registerer) { | |
r.MustRegister( | |
collector.NewRadarrCollector(c), | |
collector.NewQueueCollector(c), | |
collector.NewHistoryCollector(c), | |
collector.NewRootFolderCollector(c), | |
collector.NewSystemStatusCollector(c), | |
collector.NewSystemHealthCollector(c), | |
) | |
}) | |
return nil |
I wonder if we should do something similar for Lidarr & Sonarr, instead of just turning it off. @codefaux - if you're up for taking a stab that, that would be great. Otherwise, I'm happy with us putting this behind a flag for now, and I can create a ticket to add it back by mathing it.
"error", err) | ||
ch <- prometheus.NewInvalidMetric(collector.errorMetric, err) | ||
return | ||
} |
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.
minor nit: can we leave the metric emission immediately below where it's collected, like we did before? So move line 285 here.
Description of the change
Benefits
Possible drawbacks
Applicable issues
Additional information