1

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

Jim C
  • 3,957
  • 25
  • 85
  • 162

1 Answers1

2

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.

ultraGentle
  • 5,084
  • 1
  • 19
  • 45
  • my question started asking if "there is an Google API" for all the metrics you mentioned above. I have been studing Firestore for some weeks and certainly I saw the dashboard and monitoring console. What I am missing is an API which I could get such info either from curl or firebase tool or gshell or anything else other than look at Google Dashboard. I do agree Google Dashboard is nice but I was required to import metrics from Firestore and import in our internal monitoring tool (eg. Dynatrace/Zabbix) – Jim C May 04 '20 at 12:56
  • 1
    Points 2 and 3 address this. 2 points you towards stackdriver logging, which you can access programmatically, (see linked docs) and 3 points you to the presence system, which you can use through the functions and realtime database APIs to achieve the same metrics as the dashboard. – ultraGentle May 04 '20 at 13:30
  • I am carefully reading each link from your answer. This link https://cloud.google.com/functions/docs/monitoring from NUMBER 2 seems only eligible for cloud function. Nevertheless we will only use Firestore. We aren't planning to use Cloud Function for this year. – Jim C May 04 '20 at 19:32
  • Your other suggested link https://stackoverflow.com/questions/54492115/where-can-i-find-stackdriver-in-firebase-console/54492936 explain how create a metric but it has nothing to do with my question "is there a Google API". Obviously the feature of creating metrics is something I will need but my issue is if I can get such metrics from other way different than looking at Google Console. Let's say I could "curl get some-google-api/" and get as response a json with metrics result. If it exists please past here any url exemplifying a Google API that you get metric results – Jim C May 04 '20 at 19:46
  • thnaks a lot for your effort to answer me. I am afraid I have to inform that none of your links points to a Google API answering about Firestore database either Metrics or Health Checks or Current Active Connectios or Exceptions or Performance. Maybe the answer is just NO, there isn't. Which is pretty shame. I guess I am not the only that want to extract/import/get/listen the data transformed in Google Console Dashboard. – Jim C May 04 '20 at 20:00
  • 1
    https://cloud.google.com/monitoring/docs/apis stackdriver has an API, is that what you mean? Also, regarding functions, I think you might be making life more difficult for yourself by ruling them out - you can have these run on firestore events like reading writing and deleting, and to log whatever you want based on that. I doubt that they would incur much cost if used for that purpose. – ultraGentle May 04 '20 at 21:47
  • I remenber I have read this page. But as far as I can see it doesn't provide any usefull answer about Firestore database. It is usefull for providing answers about third solutions or some application hosted in Google Cloud. I am interested to get same metrics/health checks/current connected clients/ any exception we can get from https://console.cloud.google.com/monitoring/dashboards/custom/5636307944385636894?authuser=0&project=firetestjimis&timeDomain=1h but instead of dash or graph I want get this from curl/postman call – Jim C May 04 '20 at 22:45