” It’s hard enough to find an error in your code when you’re looking for it; it’s even harder when you’ve assumed your code is error-free. ” – Steve McConnel
In previous blog, we have tried to log the front end error’s in GoogleAnalytics, it has supported very good,
but the Google Analytics is not solely meant for error capturing and search started for exploring better error reporting system. Then just discovered about Google Stackdriver.
Google has acquired cloud monitoring service Stackdriver in 2014.
Google Stackdriver provides powerful monitoring, logging, and diagnostics. It equips you with insight into the health, performance, and availability of cloud-powered applications, enabling you to find and fix issues faster. It is natively integrated with Google Cloud Platform, Amazon Web Services, and popular open source packages. Stack driver provides a wide variety of metrics, dashboards, alerting, log management, reporting, and tracing capabilities.
In this blog we are, are going to explore the Google Stackdriver Error Reporting API which is one among the below features,
Google Stackdriver Error Reporting API:
Stackdriver Error Reporting counts, analyzes and aggregates the crashes in your running cloud services. A centralized error management interface displays the results with sorting and filtering capabilities. A dedicated view shows the error details: time chart, occurrences, affected user count, first and last seen dates and a cleaned exception stack trace. Opt-in to receive email and mobile alerts on new errors.
What we are going to do is,
- Setup Google Stackdriver account
- Setup Error Reporting
- Try Stackdriver Error Reporting API via Explorer
- Explore the dashboard
- Google Cloud Console Mobile application
- Stackdriver API Integration possibilities
- Pricing
- Pros
- Cons
1. Setup Google Stackdriver account
This is a simple easy step to create the google stackdriver acccount with gmailId, while creating , right now skip the monitoring configuration, just create the stackdriver account. You will be asked to choose the option “Upgrade” or “Free Plan”, Choosing Upgrade option will prompt for Billing Details so lets skip that right now and Choose free.
2. Setup Error Reporting
These are the simple steps to setup,
- Setting Up Client-Side JavaScript Error Reporting
- Select or create a Cloud Platform project.
- Enable the Stackdriver Error Reporting
- Generate an API key.
The generated API can be used for posting errors to stackdriver, wheres those errors can be Awesomely viewed on dashboard.
3. Try Stackdriver Error Reporting API via Explorer
You can try the stackdriver error reporting api with this URL Provided by Google.
https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.events/report
In the API, we can post detailed errors, like API URL, IP, error message, line number, stack trace, etc.,. But there is no way to send custom data to error messages, one possible way to stringy the data and to send it to message.
4. Explore the dashboard
- Grouping
- The Dashboard has very well grouped the errors for better viewing , auto reload feature for live error loading .
- Filtering
- Sort by occurrences, number of affected users or first/last seen date.
- Filter the content by time window or service.
- Enable auto-refresh to keep an eye on the changes.
- Alerting and Notification
- It has Email alerts, mobile alerts(Cloud Console app) has push notification.
- Email settings for error notificaion, cumulative reports.
- Linking the Bugs to Bug Tracker
- It has a special feature to link the errors to a particular issue id.
- Linking with Source controls like (github, bitbucket) code , while clicking the line number on error, it integrate with source code for debugging .
5. Mobile Application for Google Cloud Console:
Google cloud console app is available on play store, it has the dashboard for error reporting, on drill downing the messages we can get more details.
It has push notification , while any error has happened and it can be controlled by notification settings.
6. Integration Possibilities :
After getting the API credentials, the user can send errors from various sources, server, front end websites, mobile application.
Stackdriver Error Reporting API : https://cloud.google.com/error-reporting/reference/rest/
Also google has developed various client libraries for sending error which is listed below.
Client Libraries : https://cloud.google.com/error-reporting/docs/client-libraries
Github repo for Client-side JavaScript exception reporting library for Stackdriver Error Reporting,
7. Pricing
Stackdriver Error Reporting supports errors sent through the use of either:
- Stackdriver Logging, which is offered in Basic and Premium service tiers. The Basic tier is free and offers up to 5GB of logs ingestion per project per month.
- The Error Reporting API, which is free to use during its beta period.
8. Pro’s
- Great dashboard
- Integrating with applications and also with issues tracking .
- Alerts and notification.
- Cloud Console on Mobile
9. Con’s
- Download the error data like exporting the errors.
- Couldn’t find a way to send extra information while sending error details, may be they are limiting the error message size, but it will be great if it has this feature.
PS : Right now, this error reporting API is in BETA
This is one of the better solution for Error Reporting service which is in the market.