Search code examples
firebasegoogle-cloud-firestoregoogle-apis-explorer

Is there a Google API answering about Firestore database either Metrics or Health Checks or Current Active Connectios or Exceptions or Performance


Context: I am total Google Cloud begginer and I have just convinced my company headers to use Firestore Realtime Database for pushing transaction status to our mobile application. We have around 4 millions users that will use significantly our application for small money transfers. Now-a-days we use the concept of polling from Android/IOS to our Microservice endpoints and it will replaced by Firebase SDK imported to our Mobile app which will listen/observe to our Firestore Collection following few Firestore Rules. Since all money transfer will be confirmed/denied in short time (from few seconds to 1 or 2 minutes) the idea of replacing polling by a real reactive approach straigh from Firestore sounded and is already ongoing coding.

The issue: Firstly I don't what to compare solutions. It is just my reality: the prodution support operators must look after our internal Dashboard. Isn't allowed to them look at Google Dashboard Console (please accept this for this question). I need get on demand metrics of our FIrestore. It is nothing to do with Google pricing. It is just our demand: they want to see metrics like:

  • how many users listening at the same time now

  • how many users took some exception during connection

  • is there any user holding connection for more than X minute

  • when was the connection pick this morning

  • any exception of any type surrounding our Firestore database

I read Code Samples carefully follow the sample step-by-step trying to figure out some idea if there is some API providing the answers I am looking for.

So, my straight question is: is there such type of Google API providing metrics about my Firestore Database? Maybe following the same idea we found in Performance Monitor which works on Mobile side also some similar aproach on Firestore side.

*** Edited

Future readers may find worth read also about a way to get Firestore metrics info striagh from curl/postman


Solution

  • A couple of things: You mentioned both Firestore and Realtime Database; just wanted to make sure that you are aware that those are two different databases offered under the Firebase umbrella.

    how many users listening at the same time now

    is there any user holding connection for more than X minute

    1. Yes, there's a dashboard: https://support.google.com/firebase/answer/6317517?hl=en. Including lots of options, like users active in the last 30 mins.

    how many users took some exception during connection

    any exception of any type surrounding our Firestore database

    1. Yes, you can track errors and other logging via Stack Driver logging. These can give you reports on your cloud functions.

    https://cloud.google.com/functions/docs/monitoring

    Where can I find Stackdriver in Firebase console?

    when was the connection pick this morning

    1. For this one, I'm not sure if you mean A. when did somebody log on in the morning, or B. what was the time that there was the peak \ most usage. If B see 1. If A,

      Real-time database has the concept of presence, which lets you know if a user is currently logged in or not. See examples here from the official documentation: https://firebase.google.com/docs/firestore/solutions/presence

    and this post

    How to make user presence mechanism using Firebase?

    1. Also applies to your

    is there any user holding connection for more than X minute

    ..............

    Edit in response to comments: I believe you are experiencing the XY problem https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem where you are focused on a particular solution, even though your problem has other solutions. User metrics, database events, and errors are all accessible through both dashboards and cloud functions. You can cURL cloud functions if you wish, or set up cron functions to auto report, or set up database trigger functions to log errors. So, while the exact way you want this to work may not exist, you just need to connect existing tools to get the result you want.