[MUSIC PLAYING]
MARIAH HART: Hi, everyone.
I'm Mariah.
Thanks for joining.
And today, Adam and I will be talking
about how and when to set up advanced alerting using
Cloud Functions for Crashlytics, Performance Monitoring, and App
Distribution.
Keeping your users happy is critical to your app success.
And app quality plays a major role in that happy meter.
Knowing your app's stability and performance
from the user's perspective is critical, especially
when your users are running your app
on a complex ecosystem of devices, form factors, and OS
versions.
The key to keeping your users happy from an app quality
perspective, is fixing issues early and fast.
Now this may come as a surprise to some of you,
but humans are impatient.
Instead of waiting for something to load
that may be taking longer than usual,
users often jump to an alternative option
that serves a similar purpose.
Development teams are moving fast and have limited time.
So it's not always practical to watch Crashlytics
and Performance Monitoring dashboards to catch every issue
as soon as it happens.
So how do we fix issues in our app
before that human impatience steps in?
With real time alerts.
Let's take a deep dive into a few advanced alerting use cases
so that you can learn about how to send real time
alerts to virtually any platform with any configuration
you'd like outside of Firebase.
ADAM DUKE: Hey, y'all.
I'm Adam, a software engineer working on Crashlytics.
And I'd like to start off with a story.
Next slide.
Imagine we work on an e-commerce app.
The team knows that the winter holiday season is coming.
It's the best time of year for sales,
and any hiccups have the potential
to cause impact to the company's reputation and finances.
So we work hard, get all our features complete,
submit our app to the store, and it goes live.
After a few weeks, the holiday break is in full swing.
Alex, right there in the center, our PM,
decides to open the Crashlytics dashboard
and check on the stability of the latest release.
He discovers that crashes aren't actually
appearing in the Crashlytics dashboard
because a critical debug symbol file for the app
wasn't uploaded.
At this point, customers are having a terrible experience,
and most of the team is off for the remainder of the year.
It's a scramble to get the DSM file uploaded,
and a backlog of crashes starts showing up
on the Crashlytics dashboard.
The on-call engineer unfortunately
ends up spending their holiday triaging bugs
while the rest of the team is off
enjoying their holiday break.
What if there was a simple way to get notified of the missing
DSM file the very first time a crash happens?
I'd like to show y'all a quick demo of a brand new missing DSM
alert connected to a Discord channel via Firebase Cloud
Function.
First, let's take a quick look at the code.
So at the top, we have our imports
from the Firebase functions SDK.
And we're going to import a few simple types that
are going to wrap the concepts that we're going to deal with.
The last thing that we need to import
is the node fetch package because we're
going to end up making an HTTP request.
The entry point to our function is on lines 8 to 23.
And its responsibility is to basically call another function
to build a POST body and then actually make the POST request.
We build the POST body with the build missing symbols POST
function.
Its responsibility is to extract data from the incoming payload
and then format it into a JSON blob
that we're going to post to the Discord webhook API.
The last piece that we need is to build a deep link back
into the Crashlytics dashboard so that we can upload our DSM
file when we get the alert.
Right here, we're maintaining a map from app ID
to some other relevant details that we need to build the URL.
So we take the incoming ID, do the lookup, get the details,
format the URL, and return it.
That's it.
So we have a total of 73 lines of code, including comments.
And let's see how it works.
So how do we deploy our function?
I'm sure you all have been sitting here all day
and seeing something similar to this several times.
So if I run the deploy, a couple of things are going to happen.
First, we're going to see TypeScript to JavaScript
compilation and linting.
Second, we're going to see that the necessary APIs are
enabled for our project.
And third, we're going to see the function actually
get deployed.
The first time you deploy your function,
it can take 90 seconds, maybe 2 minutes total.
Fortunately, I've deployed this function
and haven't changed it.
So we have a step that skips that deployment for us.
So everything's ready to go.
Let's try it out.
Here, I have a Discord channel.
Say our team uses Discord for communication.
This is where we'd like to see the alert show up.
And over here, I have my very fancy complicated test app.
If I crash the app and relaunch it--
and hopefully, the live demo fairies
are going to help us out--
we'll see the alert pop up in Discord.
[APPLAUSE]
Clicking the link should take us directly to the Firebase
dashboard where we can drag and drop upload our DSM file.
So we have some really cool tools
that we can use to customize our learning.
Can we switch back to the slides?
In addition, if we're willing to do a little more work than just
the Firebase deploy CLI, we can even choose one of the other
languages that it's supported by Google Cloud functions,
including .NET, Java, GO, PHP, Python, and Ruby.
Crashlytics, Performance Monitoring,
and App Distribution, are already
generating a bunch of the alerts waiting
to be handled by your function, like a new tester
device from App Distribution, crossing
a threshold for Performance Monitoring,
new velocity alerts from Crashlytics, and more.
I hope you have a chance to try out your own function today.
MARIAH HART: Let's look at another use case around using
Cloud Functions for Firebase.
Let's say we've built a gaming app that
helps people learn Spanish.
We've been live for a while.
And we are using our App Distribution
to share new releases with our remote QA team
before we publish them to the stores.
And things are running smoothly.
Just as we're getting ready for a big update,
new iOS devices get released.
To keep up with the market, we need
to test our app using these devices as well.
Thankfully, we're able to arrange
getting these new devices into the hands of our testers.
We're really tight on time for our big release,
so no time can be lost.
As our testers begin setting up their new devices,
they quickly realized that they can't test the app anymore.
The new devices haven't been registered for use
with our test app, so the release
won't work for them yet.
The iOS testing process requires us
to get the device IDs for each test device which
can be a bit painful.
So how will we test our app properly
on these new test devices, get all of the device IDs,
and still meet our release date?
Hm.
Fortunately, with real time alerting in App Distribution,
our app developers will be alerted of the device IDs
immediately so that they can quickly repackage their app,
go straight to testing, and de-risk the launch.
We can notify our developers by email
or by leveraging Cloud Functions for Firebase
to integrate with Discord or Slack,
as examples, in the same manner we've seen for Crashlytics.
All three products support advanced alerting,
giving you practically full power
over where you send alerts, how, to whom, and more.
These products also support classical email alerting.
Crashlytics additionally supports
basic alerting capabilities with third party integrations
like Slack, Jira, and PagerDuty.
We encourage you to set up alerts with these products,
if you haven't already, and try it out.
Thanks for taking time to learn about the power of Cloud
Functions for Firebase.
We look forward to supporting your teams
to building and maintaining high quality apps.
Please join us in the Ask Firebase Lounge
to ask any questions.
Thank you.
[MUSIC PLAYING]