@@ -35,6 +35,10 @@ def get_free_port():
3535def run_cmd (args , desc , env = None , cwd = None ):
3636 print (f"Executing: { ' ' .join (args )} ({ desc } )" )
3737 proc_env = os .environ .copy ()
38+ if "CC" not in proc_env and os .path .exists ("/usr/bin/gcc" ):
39+ proc_env ["CC" ] = "/usr/bin/gcc"
40+ if "CXX" not in proc_env and os .path .exists ("/usr/bin/g++" ):
41+ proc_env ["CXX" ] = "/usr/bin/g++"
3842 if env :
3943 proc_env .update (env )
4044 res = subprocess .run (
@@ -52,6 +56,10 @@ def start_proc(args, env, desc, cwd=None):
5256 print (f"Starting in background: { ' ' .join (args )} ({ desc } )" )
5357 # Inherit system environment and merge with custom variables
5458 proc_env = os .environ .copy ()
59+ if "CC" not in proc_env and os .path .exists ("/usr/bin/gcc" ):
60+ proc_env ["CC" ] = "/usr/bin/gcc"
61+ if "CXX" not in proc_env and os .path .exists ("/usr/bin/g++" ):
62+ proc_env ["CXX" ] = "/usr/bin/g++"
5563 proc_env .update (env )
5664 return subprocess .Popen (
5765 args ,
@@ -294,6 +302,7 @@ def main():
294302 ":grpc-interop-testing:installDist" ,
295303 "-x" ,
296304 "test" ,
305+ "-PskipCodegen=true" ,
297306 ],
298307 "Building Java interop targets" ,
299308 cwd = "../grpc-java" ,
@@ -331,24 +340,28 @@ def main():
331340 )
332341 time .sleep (1 ) # wait for collector to start listening
333342
334- # Start Server
335- env = {
336- "GRPC_EXPERIMENTAL_ENABLE_OTEL_TRACING" : "true" ,
343+ # Base env for OTLP exporter
344+ base_env = {
337345 "OTEL_EXPORTER_OTLP_ENDPOINT" : f"http://localhost:{ collector_port } " ,
338346 "OTEL_EXPORTER_OTLP_PROTOCOL" : "grpc" ,
339347 "OTEL_TRACES_EXPORTER" : "otlp" ,
340348 "OTEL_METRICS_EXPORTER" : "none" ,
341349 "OTEL_LOGS_EXPORTER" : "none" ,
342350 "GRPC_BAZEL_RUNTIME" : "1" ,
343351 }
352+
353+ server_env = base_env .copy ()
354+ if args .server in ("c++" , "java" ):
355+ server_env ["GRPC_EXPERIMENTAL_ENABLE_OTEL_TRACING" ] = "true"
356+
344357 if args .server == "c++" :
345358 server_proc = start_proc (
346359 [
347360 "./bazel-bin/test/cpp/interop/interop_server" ,
348361 f"--port={ server_port } " ,
349362 "--enable_opentelemetry=true" ,
350363 ],
351- env ,
364+ server_env ,
352365 "C++ Interop Server" ,
353366 )
354367 elif args .server == "java" :
@@ -359,7 +372,7 @@ def main():
359372 "--use_tls=false" ,
360373 "--enable_opentelemetry=true" ,
361374 ],
362- env ,
375+ server_env ,
363376 "Java Interop Server" ,
364377 )
365378 elif args .server == "python" :
@@ -370,13 +383,17 @@ def main():
370383 "--use_tls=false" ,
371384 "--enable_opentelemetry=true" ,
372385 ],
373- env ,
386+ server_env ,
374387 "Python Interop Server" ,
375388 )
376389 time .sleep (3 ) # wait for server to bind and start
377390
378391 # Run Client
379392 print (f"Running { args .client .upper ()} Client..." )
393+ client_env = base_env .copy ()
394+ if args .client in ("c++" , "java" ):
395+ client_env ["GRPC_EXPERIMENTAL_ENABLE_OTEL_TRACING" ] = "true"
396+
380397 if args .client == "c++" :
381398 client_res = run_cmd (
382399 [
@@ -387,7 +404,7 @@ def main():
387404 "--enable_opentelemetry=true" ,
388405 ],
389406 "Running C++ Interop Client" ,
390- env = env ,
407+ env = client_env ,
391408 )
392409 elif args .client == "java" :
393410 client_res = run_cmd (
@@ -400,7 +417,7 @@ def main():
400417 "--enable_opentelemetry=true" ,
401418 ],
402419 "Running Java Interop Client" ,
403- env = env ,
420+ env = client_env ,
404421 )
405422 elif args .client == "python" :
406423 client_res = run_cmd (
@@ -413,7 +430,7 @@ def main():
413430 "--enable_opentelemetry=true" ,
414431 ],
415432 "Running Python Interop Client" ,
416- env = env ,
433+ env = client_env ,
417434 )
418435
419436 print ("Client finished. Waiting for spans to flush..." )
0 commit comments