Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make collection of Prometheus data be controlled by an annotation. #315

Merged
merged 4 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ 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 collection of Prometheus data is enabled.
EnablePrometheusEnv = "ENABLE_PROMETHEUS"

// PoolLabel is the key for a label which will have the name of a pool as
// the value.
PoolLabel = "pool"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: go_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: go_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: java_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: java_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: node_to_node_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: node_to_node_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: php7_protobuf_php_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: php7_protobuf_php_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: php7_protobuf_c_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: php7_protobuf_c_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: go_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: go_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: java_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: java_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: node_to_node_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: node_to_node_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: php7_protobuf_php_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: php7_protobuf_php_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: php7_protobuf_c_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: php7_protobuf_c_extension_to_cpp_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: python_asyncio_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: python_asyncio_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: python_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
pool: ${workers_pool}
scenario: python_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: prebuilt-proxyless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: python_asyncio_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: python_asyncio_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: python_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxied
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: e2etest.grpc.io/v1
kind: LoadTest
metadata:
annotations:
enablePrometheus: 'true'
scenario: python_protobuf_async_unary_5000rpcs_1KB_psm_8channels_16threads_5000load
uniquifier: proxyless
labels:
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
12 changes: 7 additions & 5 deletions containers/runtime/driver/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ 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}" ]; 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 \
--container_name=sidecar
if [ -z "${SERVER_TARGET_OVERRIDE}" ] || [ -z "${ENABLE_PROMETHEUS}" ]; then
if [ "$(dig +short -t srv prometheus.test-infra-system.svc.cluster.local)" ]; 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 \
--container_name=sidecar
fi
fi
fi
python3 /src/code/tools/run_tests/performance/bq_upload_result.py --bq_result_table="${BQ_RESULT_TABLE}"
Expand Down
2 changes: 1 addition & 1 deletion kubehelpers/psm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/grpc/test-infra/config"
)

//IsPSMTest checks if a given LoadTest is a (proxied or proxyless) service
// IsPSMTest checks if a given LoadTest is a (proxied or proxyless) service
// mesh test. This test must be performed after validating the client specs.
func IsPSMTest(clients *[]grpcv1.Client) bool {
for _, c := range *clients {
Expand Down
9 changes: 9 additions & 0 deletions podbuilder/podbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package podbuilder

import (
"fmt"
"strings"

"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -240,6 +241,14 @@ func (pb *PodBuilder) PodForDriver(driver *grpcv1.Driver) (*corev1.Pod, error) {
}
}

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

return pod, nil
}

Expand Down