0
0
GCPcloud~10 mins

Error Reporting in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the Error Reporting client in Python.

GCP
from google.cloud import errorreporting_v2
client = errorreporting_v2.[1]()
Drag options to blanks, or click blank then click option'
AErrorReportingServiceClient
BErrorReportingClient
CErrorClient
DReportingClient
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent client class name.
Confusing Error Reporting client with other service clients.
2fill in blank
medium

Complete the code to report an error event using the client.

GCP
error_event = {
    "message": "Example error message",
    "serviceContext": {"service": "my-service"}
}
client.[1](error_event=error_event)
Drag options to blanks, or click blank then click option'
Asend_error_event
Blog_error
Creport_error_event
Dcreate_error
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names that do not exist.
Trying to use logging methods instead of error reporting methods.
3fill in blank
hard

Fix the error in the code to properly create a service context dictionary.

GCP
service_context = {"service": [1]
Drag options to blanks, or click blank then click option'
A"my-service"
Bmy-service
Cservice-name
Dservice
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around string values.
Using variable names without defining them.
4fill in blank
hard

Fill both blanks to create a valid error event dictionary with message and service context.

GCP
error_event = {
    "message": [1],
    "serviceContext": {"service": [2]
}
Drag options to blanks, or click blank then click option'
A"An error occurred"
Berror_message
C"my-service"
Dservice_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without quotes.
Mixing variable names and string literals incorrectly.
5fill in blank
hard

Fill all three blanks to report an error event with a message, service name, and version.

GCP
error_event = {
    "message": [1],
    "serviceContext": {
        "service": [2],
        "version": [3]
    }
}
client.report_error_event(error_event=error_event)
Drag options to blanks, or click blank then click option'
A"Critical failure"
B"payment-service"
C"v1.2.3"
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around string values.
Using undefined variables instead of string literals.