Skip to content

Commit

Permalink
Make prometheus default and can be override by annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanlin31 committed Jun 30, 2022
1 parent b5036e9 commit 3d2a363
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ const (
// DriverPortEnv specifies the name of the env variable that contains driver port.
DriverPortEnv = "DRIVER_PORT"

// EnablePrometheusEnv specifies the name of the env variable that indicates if the
// Prometheus data is collected.
EnablePrometheusEnv = "ENABLE_PROMETHEUS"
// DisablePrometheusEnv specifies the name of the env variable that indicates
// if the collection of Prometheus data is disabled.
DisablePrometheusEnv = "DISABLE_PROMETHEUS"

// PoolLabel is the key for a label which will have the name of a pool as
// the value.
Expand Down
13 changes: 10 additions & 3 deletions config/samples/templates/psm/cxx_example_loadtest_proxied.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ spec:
- containers/runtime/xds-server/bootstrap.json
command:
- main
image: ${psm_image_prefix}/xds-server:${psm_image_tag}
image: gcr.io/grpc-testing/e2etest/runtime/xds-server:v1.3.0
livenessProbe:
initialDelaySeconds: 30
periodSeconds: 5
tcpSocket:
port: 10000
name: xds-server
- image: ${psm_image_prefix}/sidecar:${psm_image_tag}
- image: gcr.io/grpc-testing/e2etest/runtime/sidecar:v1.3.0
livenessProbe:
initialDelaySeconds: 30
periodSeconds: 5
Expand All @@ -59,7 +59,14 @@ spec:
driver:
language: cxx
name: '0'
run: []
run:
- args:
- -c
- |
sleep 2h
command:
- bash
name: main
scenariosJSON: |
{
"scenarios": {
Expand Down
1 change: 1 addition & 0 deletions containers/runtime/driver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ RUN apt-get update && apt-get install -y \
pkg-config \
gnupg \
apt-transport-https \
dnsutils \
ca-certificates

RUN apt-get update && apt-get install -y \
Expand Down
2 changes: 1 addition & 1 deletion containers/runtime/driver/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [ -n "${BQ_RESULT_TABLE}" ]; then
fi
if [ -r "${NODE_INFO_OUTPUT_FILE}" ]; then
cp "${NODE_INFO_OUTPUT_FILE}" node_info.json
if [ -n "${SERVER_TARGET_OVERRIDE}" ] || [ -n "${ENABLE_PROMETHEUS}" ]; then
if [ "$(dig +short -t srv prometheus.test-infra-system.svc.cluster.local)" ] && [ -z "${DISABLE_PROMETHEUS}" ]; then
python3 /src/code/tools/run_tests/performance/prometheus.py \
--url=http://prometheus.test-infra-system.svc.cluster.local:9090 \
--pod_type=clients --container_name=main \
Expand Down
4 changes: 2 additions & 2 deletions podbuilder/podbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ func (pb *PodBuilder) PodForDriver(driver *grpcv1.Driver) (*corev1.Pod, error) {
}
}

usePrometheus, ok := pb.test.Annotations["enablePrometheus"]
usePrometheus, ok := pb.test.Annotations["disablePrometheus"]
if ok && strings.ToLower(usePrometheus) == "true" {
runContainer.Env = append(runContainer.Env,
corev1.EnvVar{
Name: config.EnablePrometheusEnv,
Name: config.DisablePrometheusEnv,
Value: "true"})
}

Expand Down

0 comments on commit 3d2a363

Please sign in to comment.