So, when you sign up for GrafanaCloud, there is a product there called GrafanaCloud Front End Observability, which is the hosted service from Grafana that uses GrafanaFaro web SDK under the hood. It contains predefined dashboards, making it easier to start with Faro.
Now, since I only have a short time for this talk, I'll be demonstrating how you can set up GrafanaFaro using the Front End Observability product, which is included for free as part of your Grafana's free forever plan. So, to demonstrate how we can set up GrafanaFaro, I'll be instrumenting a sample application called QuickPizza. It's available publicly at github.com/grafana/quickpizza. And there's a bunch of detailed information on how to set this up locally.
So now let's jump into the demo. QuickPizza is a very simple application that you can use to generate new and exciting pizza combinations. It can be set up easily using Docker, and we've added a bunch of instructions here that can guide you depending on what sort of tests or what sort of use case you want.
So I already have the application up and running. And as you can see, it's just a very simple application. There is a pizza please button. If you click that, it will just generate some random and exciting pizza combination. At the same time, there's also an advanced tab and you can set the maximum calories per slice, minimum number of toppings, and the maximum number of toppings. And you can also exclude some different tools.
Now let's just imagine that one of your users have gone rogue and they've just typed in a very random number as part of the minimum number of toppings field. Now when they click pizza please, they can still see that there are some pizza recommendations, even though clearly the value that we've added here is not correct. So let's open the developer tools console and see if there are any errors that are being printed. So let's just open up the console and see what's happening.
So as you can see, there's a bunch of JavaScript errors that are being printed, but they're not being handled properly by our frontend application. So ideally, you want to catch these errors and maybe display some sort of warning or error message so your users will know that they've done something incorrectly. So if we're using Grafana Faro, how can we then track these different errors?
The first thing that I'm going to do is I'm going to just go back to home. So when you create your Grafana Cloud account, you're going to be redirected to this landing page and you should see a frontend tab here for the frontend observability product. I've already created the QuickPizza application here, but you can simply create a new project just by clicking the create new, providing a name, course allowed origin. So this is basically the URL that's allowed to send the frontend data to the Grafana Faro endpoint. So in our case, this is just going to be the localhost port. So once you've done that, I'm just going to press the edit here, you should see a tab for the web SDK configuration.
The Grafana Faro URL, so this is the URL that I'm talking about. So from a QuickPizza perspective, all you need to do is add that URL and export that to an environment variable called QuickPizza.conf.faro.url and then add that to the .env file.
Comments