Skip to content

Commit

Permalink
Silently catch Exception in recommendationservice (GoogleCloudPlatfor…
Browse files Browse the repository at this point in the history
…m#460)

* Update recommendation_server.py

* Update development-guide.md

* Update README.md

* Update README.md

* Update README.md

* silently track when can't enable clouddebugger
  • Loading branch information
mathieu-benoit authored Dec 15, 2020
1 parent ae08cd7 commit f1bb5e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ Looking for the old Hipster Shop frontend interface? Use the [manifests](https:/

## Quickstart (GKE)

1. **[Create a Google Cloud Platform project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project)** or use an existing project. Set the `PROJECT_ID` environment variable and ensure the Google Kubernetes Engine API is enabled.
1. **[Create a Google Cloud Platform project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project)** or use an existing project. Set the `PROJECT_ID` environment variable and ensure the Google Kubernetes Engine and Cloud Operations APIs are enabled.

```
PROJECT_ID="<your-project-id>"
gcloud services enable container --project ${PROJECT_ID}
gcloud services enable container.googleapis.com --project ${PROJECT_ID}
gcloud services enable monitoring.googleapis.com \
cloudtrace.googleapis.com \
clouddebugger.googleapis.com \
cloudprofiler.googleapis.com \
--project ${PROJECT_ID}
```

2. **Clone this repository.**
Expand Down Expand Up @@ -178,4 +183,4 @@ If you would like to contribute features or fixes to this app, see the [Developm

---

This is not an official Google project.
This is not an official Google project.
6 changes: 3 additions & 3 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ This doc explains how to build and run the OnlineBoutique source code locally us
- kubectl (can be installed via `gcloud components install kubectl`)
- [skaffold]( https://skaffold.dev/docs/install/), a tool that builds and deploys Docker images in bulk.
- A Google Cloud Project with Google Container Registry enabled.
- Enable GCP APIs for Cloud Monitoring, Tracing, Debugger:
- Enable GCP APIs for Cloud Monitoring, Tracing, Debugger, Profiler:
```
gcloud services enable monitoring.googleapis.com \
cloudtrace.googleapis.com \
clouddebugger.googleapis.com
clouddebugger.googleapis.com \
cloudprofiler.googleapis.com
```
- [Minikube](https://minikube.sigs.k8s.io/docs/start/) (optional - see Local Cluster)
- [Kind](https://kind.sigs.k8s.io/) (optional - see Local Cluster)
Expand All @@ -28,7 +29,6 @@ gcloud services enable monitoring.googleapis.com \

```sh
gcloud services enable container.googleapis.com
gcloud services enable cloudprofiler.googleapis.com
```

```sh
Expand Down
4 changes: 2 additions & 2 deletions src/recommendationservice/recommendation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def Watch(self, request, context):
module='recommendationserver',
version='1.0.0'
)
except (Exception, err):
except (Exception, DefaultCredentialsError):
logger.error("Could not enable debugger")
logger.error(traceback.print_exc())
pass
except KeyError:
except (Exception, DefaultCredentialsError):
logger.info("Debugger disabled.")

port = os.environ.get('PORT', "8080")
Expand Down

0 comments on commit f1bb5e1

Please sign in to comment.