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 a Prometheus metrics endpoint #99

Open
jtslear opened this issue Nov 4, 2019 · 6 comments
Open

Add a Prometheus metrics endpoint #99

jtslear opened this issue Nov 4, 2019 · 6 comments

Comments

@jtslear
Copy link

jtslear commented Nov 4, 2019

Currently it's difficult to view the performance of the mail_room gem. If the gem emitted metrics, we can start measuring performance and other relatable data in order to alert Engineers if things are going wrong. This can also be useful as an endpoint could be utilized for monitoring the health of the service in general, whether it be a docker daemon or Kubernetes healthcheck.

Also consider that it may be wise to include metrics of monitoring the mailbox for which mail_room is configured to look at. This prevents the need for persons to stand up a secondary system such as https://github.com/camptocamp/imap-mailbox-exporter to monitor the mailbox.

@tpitale
Copy link
Owner

tpitale commented Nov 4, 2019

What do you mean by “performance”? What metrics would you ask be included?

Output of stats to a log file was recently added to introspect certain behaviors. This may provide the information you’re looking for.

@tpitale
Copy link
Owner

tpitale commented Nov 4, 2019

@jtslear
Copy link
Author

jtslear commented Nov 5, 2019

Performance meaning the functionality of mail_room in general. Here is an initial proposal:

  • count of unread emails
  • count of read emails
  • count of deleted emails
  • count of expunged emails
  • count of processed emails
  • count of skipped emails due to arbitration

Labels for each of these would probably include some identifier so we know which inbox we were processing in cases where there may exist multiple inboxes mail_room is monitoring

The count of processed emails should also have labels to indicate which delivery mechanism is used in cases where multiples might be configured.

The use of count in the above proposal allows us to query items and create charts for the rate at which actions are completing.

The important items to us would be the actions that mail_room takes and ensuring we have metrics for those actions. And I propose Prometheus as this is something we already heavily utilize inside of our infrastructure today.

@tpitale
Copy link
Owner

tpitale commented Nov 5, 2019

For the purpose of alerting engineers, you could consume the json logs that were added. That should give you a decent amount of information, and perhaps let you aggregate and come up with the rate of processing.

@tpitale
Copy link
Owner

tpitale commented Nov 5, 2019

I'm willing to consider adding the ability for mail_room to emit events (ala https://github.com/beam-telemetry/telemetry) internally. I would then be able to accept a PR to add the interface to something like prometheus.

I don't know that there will be events for all of the things you listed, I'll have to look more closely.

@tpitale
Copy link
Owner

tpitale commented Jan 24, 2020

Related. I created this: https://github.com/tpitale/telemetry-ruby

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