nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #234

Your team detected a spike of errors in an application running on Cloud Run in your production project. The application is configured to read messages from Pub/Sub topic A, process the messages, and w

The correct answer is A. Deploy the Pub/Sub and Cloud Run emulators on your local machine. Deploy the application. To safely reproduce and diagnose errors without affecting the production environment, you should use local emulators. Deploying both the Pub/Sub emulator and the Cloud Run emulator locally and running the application against them creates a fully isolated test environment. This al

Building and Testing Applications

Question

Your team detected a spike of errors in an application running on Cloud Run in your production project. The application is configured to read messages from Pub/Sub topic A, process the messages, and write the messages to topic B. You want to conduct tests to identify the cause of the errors. You can use a set of mock messages for testing. What should you do?

Options

  • ADeploy the Pub/Sub and Cloud Run emulators on your local machine. Deploy the application
  • BUse the gcloud CLI to write mock messages to topic A. Change the logging level in the
  • CDeploy the Pub/Sub emulator on your local machine. Point the production application to your local
  • DUse the Google Cloud console to write mock messages to topic A. Change the logging level in

How the community answered

(48 responses)
  • A
    81% (39)
  • B
    2% (1)
  • C
    13% (6)
  • D
    4% (2)

Explanation

To safely reproduce and diagnose errors without affecting the production environment, you should use local emulators. Deploying both the Pub/Sub emulator and the Cloud Run emulator locally and running the application against them creates a fully isolated test environment. This allows you to inject mock messages and observe behavior without any risk to production data or services. Option C is dangerous because it points the live production application to a local emulator, which could disrupt production processing. Options B and D write mock messages directly to the production topic A, which could corrupt or interfere with real production data and processing.

Topics

#Cloud Run#Pub/Sub#Local Emulators#Debugging

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice