Google Cloud - Error Reporting Client Libraries

2/17/2021

I'd like to use the Google Error Reporting Client library (from google.cloud import error_reporting).

Basically, you instantiate a client: client = error_reporting.Client(service="my_script", version="my_version") and then you can raise error using: 1) client.report("my message") or 2) client.report_exception() when an exception is caught

I have 3 environments (prod, staging and dev). They are each setup on their own Kubernetes cluster (with their own namespace). When I look at Google Cloud Error Reporting dashboard, I would to quickly locate on which environment and which class/script the error was raised.

Using service is a natural choice to describe the class/script but what about the environment? What is the best practice? Should I use the version to store that, e.g. version="staging_0.0.2"?

Many thanks in advance Cheers, Lamp'

-- lampalork
error-reporting
google-cloud-error-reporting
google-cloud-logging
kubernetes
python

1 Answer

2/25/2021

I think the Error Reporting service is deficient (see comment above).

Since you're using Kubernetes, how about naming your Error Reporting services to reflect Kubernetes Service names: ${service}.${namespace}.svc.cluster.local?

You could|should replace the internal cluster.local domain part with some unique external specifier (FQDN) to your cluster: $[service}.${namespace}.${cluster}

NOTE These needn't be actual Kubernetes Services but some way for you to uniquely identify the thing within a Kubernetes cluster my_script.errorreporting.${namespace}.${cluster}

-- DazWilkin
Source: StackOverflow