You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Error Reporting is a Google Cloud service that automatically analyses log entries to identify, aggregate, and track application errors. Instead of manually searching through thousands of log entries for exceptions, Error Reporting groups related errors together, tracks their frequency over time, and alerts you when new errors appear. It is tightly integrated with Cloud Logging and Cloud Trace.
Error Reporting scans log entries written to Cloud Logging for recognised error patterns — primarily exception stack traces and error-level log entries. When it finds an error, it:
Error Reporting automatically detects errors from several Google Cloud services without any additional configuration:
| Service | What is Detected |
|---|---|
| App Engine | Unhandled exceptions, application crashes |
| Cloud Functions | Uncaught exceptions, function timeout errors |
| Cloud Run | Container crashes, unhandled exceptions in request handlers |
| GKE | Container exceptions written to stderr |
| Compute Engine | Errors reported through the Ops Agent or client libraries |
The core concept in Error Reporting is the error group — a collection of error events that share the same root cause. Error Reporting groups errors by:
NullPointerException, ConnectionRefusedErrorEach error group provides:
| Field | Description |
|---|---|
| Error message | The error message or exception text |
| Stack trace | The full call stack at the time of the error |
| First seen | When the error first appeared |
| Last seen | The most recent occurrence |
| Occurrences | Total count and a histogram showing frequency over time |
| Affected services | Which services and versions produced this error |
| Affected users | Count of unique users who experienced the error (if user context is provided) |
| Linked issues | Links to bug tracking systems (e.g., Jira, GitHub Issues) |
from google.cloud import error_reporting
client = error_reporting.Client()
try:
result = process_order(order_id)
except Exception:
client.report_exception()
const { ErrorReporting } = require('@google-cloud/error-reporting');
const errors = new ErrorReporting();
app.get('/api/orders/:id', async (req, res) => {
try {
const order = await getOrder(req.params.id);
res.json(order);
} catch (err) {
errors.report(err);
res.status(500).send('Internal Server Error');
}
});
You can report errors without a client library by writing structured JSON to Cloud Logging with the correct format:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.