[WIP] Fixes emailservice CrashLoop when Workload Identity is enabled (#280)

* Adds explicit PROJECT_ID for stackdriver exporter

* save work

* cleanup
This commit is contained in:
Megan O'Keefe 2019-12-17 13:41:59 -05:00 committed by GitHub
parent 8cfb88bf2f
commit 04b2084779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View file

@ -34,6 +34,8 @@ spec:
env:
- name: PORT
value: "8080"
- name: ENABLE_PROFILER
value: "0"
readinessProbe:
periodSeconds: 5
exec:
@ -42,9 +44,6 @@ spec:
periodSeconds: 5
exec:
command: ["/bin/grpc_health_probe", "-addr=:8080"]
env:
- name: ENABLE_PROFILER
value: "0"
resources:
requests:
cpu: 100m

View file

@ -37,7 +37,9 @@ import googlecloudprofiler
try:
sampler = always_on.AlwaysOnSampler()
exporter = stackdriver_exporter.StackdriverExporter()
exporter = stackdriver_exporter.StackdriverExporter(
project_id=os.environ.get('GCP_PROJECT_ID'),
transport=AsyncTransport)
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
except:
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()

View file

@ -99,7 +99,9 @@ if __name__ == "__main__":
try:
sampler = always_on.AlwaysOnSampler()
exporter = stackdriver_exporter.StackdriverExporter()
exporter = stackdriver_exporter.StackdriverExporter(
project_id=os.environ.get('GCP_PROJECT_ID'),
transport=AsyncTransport)
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
except:
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
@ -123,7 +125,8 @@ if __name__ == "__main__":
product_catalog_stub = demo_pb2_grpc.ProductCatalogServiceStub(channel)
# create gRPC server
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) # ,interceptors=(tracer_interceptor,))
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10),
interceptors=(tracer_interceptor,))
# add class to gRPC server
service = RecommendationService()