Rails — Disable Stackdriver in development

Martin Samami
Sep 7, 2018 · 1 min read

I recently had the opportunity to experiment with Stackdriver inside a fresh Rails project. After installing the gem and starting the Rails server I noticed a whole lot of warnings ending up in my logs:

Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
...
Note: Google::Cloud::Logging is disabled because the project ID could not be determined. Falling back to the default Rails logger.
...
Note: Google::Cloud::Debugger is disabled because the project ID could not be determined.
...
Note: Google::Cloud::ErrorReporting is disabled because the project ID could not be determined.
...
Note: Google::Cloud::Trace is disabled because the project ID could not be determined.

I figured that I just needed to disable them in development — I don’t really want them to be reporting any data while testing things out locally anyway.

I couldn’t find a good source for disabling all of the necessary services, so here goes:

# config/development.rb
Rails.application.configure do
...
config.google_cloud.use_trace = false
config.google_cloud.use_logging = false
config.google_cloud.use_error_reporting = false
config.google_cloud.use_debugger = false
end

Martin Samami

Written by

Love building things.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade