Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion continuous_load_testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM eclipse-temurin
COPY build/install/continuous_load_testing /app
# Uncomment the line below to enable CloudPath instead of DirectPath
# ENV GOOGLE_CLOUD_DISABLE_DIRECT_PATH=true
# ENV DISABLE_DIRECT_PATH=true
CMD /app/bin/continuous_load_testing --methods=EmptyCall --concurrency=1
2 changes: 1 addition & 1 deletion continuous_load_testing/client-java-cloudpath.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
fieldPath: metadata.namespace
- name: CONTAINER_NAME
value: client-java-cloudpath
- name: GOOGLE_CLOUD_DISABLE_DIRECT_PATH
- name: DISABLE_DIRECT_PATH
value: "true"
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.name=$(POD_NAME),k8s.namespace.name=$(NAMESPACE_NAME),k8s.container.name=$(CONTAINER_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ private enum Method {
}

private static final Logger logger = Logger.getLogger(Client.class.getName());
private static final String BACKEND = "google-c2p:///directpathgrpctesting-pa.googleapis.com";
private static final String DIRECTPATH_BACKEND = "google-c2p:///directpathgrpctesting-pa.googleapis.com";
private static final String CLOUDPATH_BACKEND = "dns:///directpathgrpctesting-pa.googleapis.com";
private static final Set<Method> methods = new HashSet<>(Arrays.asList(Method.values()));
private static int concurrency = 1;
private static int num_of_requests = 10;
Expand Down Expand Up @@ -79,6 +80,13 @@ public static void main(String[] args) {
GrpcOpenTelemetry grpcOpenTelemetry = initializeOpenTelemetry();

ChannelCredentials credentials = GoogleDefaultChannelCredentials.create();
String disableDirectPath = System.getenv("DISABLE_DIRECT_PATH");
String BACKEND;
if ("true".equals(disableDirectPath)) {
BACKEND = CLOUDPATH_BACKEND;
} else {
BACKEND = DIRECTPATH_BACKEND;
}
ManagedChannelBuilder<?> builder = Grpc.newChannelBuilder(BACKEND, credentials);
grpcOpenTelemetry.configureChannelBuilder(builder);
TestServiceStub stub = TestServiceGrpc.newStub(builder.build());
Expand Down