[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:
parent
8cfb88bf2f
commit
04b2084779
3 changed files with 10 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue