Fix local clusters (#318)
This commit is contained in:
parent
f1a8e88f9b
commit
1cf78ea7d8
2 changed files with 4 additions and 2 deletions
|
@ -22,6 +22,7 @@ import time
|
||||||
import grpc
|
import grpc
|
||||||
from jinja2 import Environment, FileSystemLoader, select_autoescape, TemplateError
|
from jinja2 import Environment, FileSystemLoader, select_autoescape, TemplateError
|
||||||
from google.api_core.exceptions import GoogleAPICallError
|
from google.api_core.exceptions import GoogleAPICallError
|
||||||
|
from google.auth.exceptions import DefaultCredentialsError
|
||||||
|
|
||||||
import demo_pb2
|
import demo_pb2
|
||||||
import demo_pb2_grpc
|
import demo_pb2_grpc
|
||||||
|
@ -189,7 +190,7 @@ if __name__ == '__main__':
|
||||||
project_id=os.environ.get('GCP_PROJECT_ID'),
|
project_id=os.environ.get('GCP_PROJECT_ID'),
|
||||||
transport=AsyncTransport)
|
transport=AsyncTransport)
|
||||||
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
|
||||||
except KeyError:
|
except (KeyError, DefaultCredentialsError):
|
||||||
logger.info("Tracing disabled.")
|
logger.info("Tracing disabled.")
|
||||||
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ from concurrent import futures
|
||||||
|
|
||||||
import googleclouddebugger
|
import googleclouddebugger
|
||||||
import googlecloudprofiler
|
import googlecloudprofiler
|
||||||
|
from google.auth.exceptions import DefaultCredentialsError
|
||||||
import grpc
|
import grpc
|
||||||
from opencensus.trace.exporters import print_exporter
|
from opencensus.trace.exporters import print_exporter
|
||||||
from opencensus.trace.exporters import stackdriver_exporter
|
from opencensus.trace.exporters import stackdriver_exporter
|
||||||
|
@ -108,7 +109,7 @@ if __name__ == "__main__":
|
||||||
project_id=os.environ.get('GCP_PROJECT_ID'),
|
project_id=os.environ.get('GCP_PROJECT_ID'),
|
||||||
transport=AsyncTransport)
|
transport=AsyncTransport)
|
||||||
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
|
||||||
except KeyError:
|
except (KeyError, DefaultCredentialsError):
|
||||||
logger.info("Tracing disabled.")
|
logger.info("Tracing disabled.")
|
||||||
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue