jamesread / prometheus-gmail-exporter

Checks gmail labels for unread messages and exposes the counts via prometheus.
Apache License 2.0
47 stars 9 forks source link

How to get count of Important in Inbox? #28

Open vorburger opened 1 year ago

vorburger commented 1 year ago

@jamesread do you happen to know if the Gmail API could somehow allow us to count the Important messages in Inbox?

The gmail_IMPORTANT_total (and gmail_IMPORTANT_unread) counts ALL messages, not just those which are (also) gmail_INBOX_total (and gmail_INBOX_unread) in the Inbox.

Might it be possible to get a count for Gmail "queries", such as is:important in:inbox?

jamesread commented 1 year ago

Hey @vorburger , sorry for the delay in replying to you. Indeed, I think you'd have to use a "query" for this, which would have to come as a new feature to the project. I'd happy to accept a PR for this.

In the configuration file, it would be good to allow these queries to be added as a list, and an alias. Somethng like this;

customQueries:
  - name: fooquery
    value: "important in:inbox"

Which would then expose metrics like gmail_fooquery_total.