Firebase RealTime Database Cron Job [duplicate] - firebase

This question already has answers here:
How to run cron job with Firebase?
(6 answers)
Cloud Functions for Firebase trigger on time?
(3 answers)
Closed 1 year ago.
I using Firebase Real-Time Database.
My example structure:
fruits:{
apple:{
soldAllTime:500
Verify:true
soldDaily:30
},
banana:{
soldAllTime:350
Verify:true
soldDaily:27
},
}
II want all 'soldDaily's to be reset at 00:00 UTC every day. What is the easiest and most logical way?

Yes, there is an option in Firebase. Its called schedule functions. With this, you can schedule a task based on time interval like every 5 mins etc., or based on exact time like every day at 12:00 PM.
However, you need to have Blaze plan in order to use this feature.
Check this answer.

Related

Is it possible to refill intraday tables into BigQuery from firebase? [duplicate]

This question already has an answer here:
How to get an export of firebase analytics full historic data?
(1 answer)
Closed 12 days ago.
I'm using streaming data exports from firebase to bigQuery and it's working fine, yesterday I excluded events from the data by mistake so yesterday's table 20230207 came with missing events. is there any way to refill this table on this specific date back to bigQuery with the updated events settings
I tried to look if there is a manual option to refill that table, but didn't find
There is no way to retrieve historical data from Google Analytics.
Also see:
How to get app's old analytics data from firebase to bigquery?
How to get an export of firebase analytics full historic data?

Check periodically when API, when returns true/false update firestore [duplicate]

This question already has answers here:
Is there any TTL (Time To Live ) for Documents in Firebase Firestore
(3 answers)
Firebase functions updating / deleting document after a certain time
(1 answer)
Overwrite firestore field after 5 minutes of no update
(1 answer)
Closed 12 months ago.
I am unsure of which solution or Google product to use. The flow is as follows:
We have a collection in firestore for each product.
A product gets purchased and enters a "pending" collection.
That product in "pending" may take 1 minute to a few hours to confirm.
We want to check every few minutes or so for the first hour to see if it has confirmed.
If it doesn't confirm within the hour then we want to check less regularly to eventually decide an outcome of confirmed or failed.
I am using firebase functions and firestore currently. Considered using Google Cloud Tasks but not sure if there is a simple solution I am overlooking.

Events from Firebase Analytics not showing up in Big Query [duplicate]

This question already has an answer here:
How to get an export of firebase analytics full historic data?
(1 answer)
Closed 3 years ago.
I have an trouble when linking Firebase Event to Big data.
In Firebase Analytics, I have many event .
I linked firebase with Big Query
But in Big Query, I can't see it.
How can I see it?
From the documentation:
Once an app is linked to BigQuery, a corresponding dataset is created in the associated BigQuery project upon the first daily export of events. Each day, raw event data for each linked app populates a new table in the associated dataset, and raw event data is streamed into an intraday BigQuery table in real-time. Data prior to linking to BigQuery is not available for import.

Grafana + Graphite: sum over time, with static beginning of time range

I am using Grafana with Graphite.
I have a metric for tickets that changed state to Closed. Applying integral() and keepLastValue() I am able to plot the current Closed tickets. As integral() resets (starts at zero) on the left side of the graph I only get the Closed tickets for the defined time period. I also need previous Closed tickets.
For instance, if there were 5 closed tickets in day 1, when ploting the closed tickets for day 2 (time range from: day 2 midnight), I want those 5 tickets to be accounted.
Is there some way to acomplish this with Grafana and Graphite?
Thanks.
Rather than storing a 1 for each ticket that's closed and using integral(), store the total number of closed tickets every minute.
That way you already have the data in the form you need for the graph you want.
To generate a graph that shows the ticket close activity you'd then use derivative().

Last “end date” with data in Analytics

I'm using "Reporting google Analitics API" and I can’t find information about what the last “end date” with data in Analytics is.
For example, let's suppose you want to retrive the last month’s data.
When do you have to perform the query?
The first day of the current month?
...or the second one?
...or maybe the third one?
And only another question: are the returned data for days in pacific time?
Google Analytics API is supposed to have access to the same data you have in the interface.
Google says that data can take up to 24h to process. The time it takes to really update the data depends on the type and size of the account. Small accounts are updated multiple times a day and can have data available in just a few hours. Once you reach 1M hits a month you are moved to a different mode where the data on your account is updated only once a day. Google Analytics Premium customers have updates more often even for large ammounts of traffic.
There's no way to tell through the API what is exactly the time of the last hit processed. You can query the data for today by the hour and see for yourself though.
Usually you don't care and just want to make sure that the data you're querying has been fully processed for that day.
So if you query data for yesterday there's a chance it has not being completely updated, for example if it's midnight the data for yesterday is just a couple minutes ago and probably haven't been completely processed yet. The safest bet in this case is to query data for 2 days ago.
So if today is 2012-06-15 and you want to get 1 month of data a safe approach is to query data with start-date=2012-05-13 and end-date=2012-06-13. This will most of the time give you data for days that have been fully processed, but it's not 100% safe as well. Google Analytics have had outages in the past where data took longer than that to process, these are not usual though. When you get the data out it's really hard to tell just for the API if the data for those days have been fully processed or not, using the 2 days ago isea you just make it more likely that it is.
The days are aggregate following your timezone settings configured on the Google Analytics profile.

Resources