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

mq_prometheus: allow enable/disable status metrics separately #263

Closed
sigilioso opened this issue Nov 20, 2023 · 4 comments
Closed

mq_prometheus: allow enable/disable status metrics separately #263

sigilioso opened this issue Nov 20, 2023 · 4 comments

Comments

@sigilioso
Copy link

We are using the mq_prometheus exporter and we would like to enable or disable the collection of different status separately.

Using the ibmmq.useStatus option it is possible to enable/disable the collection of metrics from all object STATUS fields. However, we would like to do this separately. For instance, we would like to be able to keep Queue status, but disable the collection of Channel and Topic status:

I guess we would need to modify the exporter to check additional configuration fields:

				// check ChannelStatus configuration flag here
				if err == nil {
					err := mqmetric.CollectChannelStatus(config.cf.MonitoredChannels)
					if err != nil {
						log.Errorf("Error collecting channel status: %v", err)
						pollError = err
					} else {
						log.Debugf("Collected all channel status")
					}
				}
				// check TopicStatus configuration flag here
				if err == nil {
					err = mqmetric.CollectTopicStatus(config.cf.MonitoredTopics)
					if err != nil {
						log.Errorf("Error collecting topic status: %v", err)
						pollError = err
					} else {
						log.Debugf("Collected all topic status")
					}
				}
				// check SubStatus configuration flag here
				if err == nil {
					err = mqmetric.CollectSubStatus(config.cf.MonitoredSubscriptions)
					if err != nil {
						log.Errorf("Error collecting subscription status: %v", err)
						pollError = err
					} else {
						log.Debugf("Collected all subscription status")
					}
				}
				// check QueueStatus configuration flag here
				if err == nil {
					err = mqmetric.CollectQueueStatus(config.cf.MonitoredQueues)
					if err != nil {
						log.Errorf("Error collecting queue status: %v", err)
						pollError = err
					} else {
						log.Debugf("Collected all queue status")
					}
				}

I am aware we could use filters, but we would like to avoid polling resources when metrics are not needed.

If this use case makes sense to you and you could provide some guidance, we would be happy to contribute to get it implemented.

@ibmmqmet
Copy link
Collaborator

If you don't set any object patterns, then no status queries should actually be made for that object type. eg

objects:
   channels:
   topics:

Functions like CollectChannelStatus would simply return immediately.

@sigilioso
Copy link
Author

Thanks for pointing that out @ibmmqmet,

I think I got it wrong because the patterns are checked after initializing everything else to perform status queries.

Would it make sense to move the check to the beginning of those functions?

@ibmmqmet
Copy link
Collaborator

I don't think so.

Most of the code "above" the checking of the patterns makes sure we've got a clean response back to the main functions. While none of the current collectors do it, I can certainly imagine collectors that dynamically change the list of objects, and would rely on having that cleanup processing done between each iteration.

@sigilioso
Copy link
Author

Thanks for the explanation.

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

No branches or pull requests

2 participants