[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:
|
env:
|
||||||
- name: PORT
|
- name: PORT
|
||||||
value: "8080"
|
value: "8080"
|
||||||
|
- name: ENABLE_PROFILER
|
||||||
|
value: "0"
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
exec:
|
exec:
|
||||||
|
@ -42,9 +44,6 @@ spec:
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
exec:
|
exec:
|
||||||
command: ["/bin/grpc_health_probe", "-addr=:8080"]
|
command: ["/bin/grpc_health_probe", "-addr=:8080"]
|
||||||
env:
|
|
||||||
- name: ENABLE_PROFILER
|
|
||||||
value: "0"
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
|
|
|
@ -37,7 +37,9 @@ import googlecloudprofiler
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sampler = always_on.AlwaysOnSampler()
|
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)
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
|
||||||
except:
|
except:
|
||||||
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
||||||
|
|
|
@ -99,7 +99,9 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sampler = always_on.AlwaysOnSampler()
|
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)
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor(sampler, exporter)
|
||||||
except:
|
except:
|
||||||
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
||||||
|
@ -123,7 +125,8 @@ if __name__ == "__main__":
|
||||||
product_catalog_stub = demo_pb2_grpc.ProductCatalogServiceStub(channel)
|
product_catalog_stub = demo_pb2_grpc.ProductCatalogServiceStub(channel)
|
||||||
|
|
||||||
# create gRPC server
|
# 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
|
# add class to gRPC server
|
||||||
service = RecommendationService()
|
service = RecommendationService()
|
||||||
|
|
Loading…
Reference in a new issue