Skip to content

Commit 3a7e6d3

Browse files
author
Aman Brar
authored
Add prometheus soaking and perf tests (#146)
* added environment variables to EC2 AOC deployment * make env vars only on amazon linux * remove unneeded changes * made env vars command modular and added windows env vars * remove cortex instance endpoint var for backwards compatibility * ec2 working with windows * get soaking and performance test working for prometheus_mock * increase memory for prometheus sample app in soaking/perf tests * put pull mode soaking compose in defaults * change var names * set env vars in ec2 setup amis
1 parent 9f23b86 commit 3a7e6d3

File tree

9 files changed

+66
-4
lines changed

9 files changed

+66
-4
lines changed

terraform/ec2_setup/amis.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ variable "ami_family" {
77
otconfig_destination = "/tmp/ot-default.yml"
88
download_command_pattern = "wget %s"
99
install_command = "sudo rpm -Uvh aws-otel-collector.rpm && sudo chmod 777 /opt/aws/aws-otel-collector/etc/.env && sudo echo 'GODEBUG=madvdontneed=1' >> /opt/aws/aws-otel-collector/etc/.env"
10+
set_env_var_command = "sudo chmod 777 /opt/aws/aws-otel-collector/etc/.env && sudo echo 'SAMPLE_APP_HOST=%s' >> /opt/aws/aws-otel-collector/etc/.env && sudo echo 'SAMPLE_APP_PORT=%s' >> /opt/aws/aws-otel-collector/etc/.env"
1011
start_command = "sudo /opt/aws/aws-otel-collector/bin/aws-otel-collector-ctl -c /tmp/ot-default.yml -a start"
1112
connection_type = "ssh"
1213
user_data = ""
@@ -26,6 +27,7 @@ variable "ami_family" {
2627
otconfig_destination = "C:\\ot-default.yml"
2728
download_command_pattern = "powershell -command \"Invoke-WebRequest -Uri %s -OutFile C:\\aws-otel-collector.msi\""
2829
install_command = "msiexec /i C:\\aws-otel-collector.msi"
30+
set_env_var_command = "powershell \"[System.Environment]::SetEnvironmentVariable('SAMPLE_APP_HOST', '%s', [System.EnvironmentVariableTarget]::Machine); [System.Environment]::SetEnvironmentVariable('SAMPLE_APP_PORT', '%s', [System.EnvironmentVariableTarget]::Machine)\""
2931
start_command = "powershell \"& 'C:\\Program Files\\Amazon\\AwsOtelCollector\\aws-otel-collector-ctl.ps1' -ConfigLocation C:\\ot-default.yml -Action start\""
3032
connection_type = "winrm"
3133
soaking_cwagent_config = "../templates/cwagent-config/soaking-linux.json.tpl"

terraform/ec2_setup/main.tf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@
1313
# permissions and limitations under the License.
1414
# -------------------------------------------------------------------------
1515

16+
module "common" {
17+
source = "../common"
18+
19+
aoc_version = var.aoc_version
20+
}
21+
1622
locals {
1723
launch_date = formatdate("YYYY-MM-DD", timestamp())
1824
}
1925

26+
data "aws_ecr_repository" "sample_apps" {
27+
name = module.common.sample_app_ecr_repo_name
28+
}
29+
2030
# launch ec2
2131
module "ec2_setup" {
2232
source = "../ec2"
@@ -27,11 +37,11 @@ module "ec2_setup" {
2737
aoc_version = var.aoc_version
2838
region = var.region
2939
testcase = var.testcase
30-
sample_app_image = var.soaking_data_emitter_image
40+
sample_app_image = var.soaking_sample_app != "" ? "${data.aws_ecr_repository.sample_apps.repository_url}:${var.soaking_sample_app}-latest" : var.soaking_sample_app_image
3141
skip_validation = true
3242

3343
# soaking test config
34-
soaking_compose_file = "../templates/defaults/soaking_docker_compose.tpl"
44+
soaking_compose_file = var.sample_app_mode == "push" ? "../templates/defaults/soaking_docker_compose.tpl" : "../templates/defaults/soaking_docker_compose_pull_mode.tpl"
3545
soaking_data_mode = var.soaking_data_mode
3646
soaking_data_rate = var.soaking_data_rate
3747
soaking_data_type = var.soaking_data_type

terraform/ec2_setup/variables.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616
variable "testing_ami" {
1717
}
1818

19-
variable "soaking_data_emitter_image" {
19+
variable "soaking_sample_app_image" {
2020
default = "aottestbed/aws-otel-load-generator:v0.1.0"
2121
}
2222

23+
variable "soaking_sample_app" {
24+
default = ""
25+
}
26+
27+
variable "soaking_compose_file" {
28+
default = "../templates/defaults/soaking_docker_compose.tpl"
29+
}
30+
2331
# data points emitted per second
2432
variable "soaking_data_rate" {
2533
default = 1000

terraform/performance/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ module "ec2_setup" {
2424
commit_id = var.commit_id
2525
testcase = var.testcase
2626
testing_ami = var.testing_ami
27+
28+
sample_app_mode = var.sample_app_mode
29+
soaking_sample_app = var.soaking_sample_app
2730
soaking_data_rate = var.data_rate
2831
soaking_data_type = var.data_type
2932
soaking_data_mode = var.soaking_data_mode

terraform/performance/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ variable "collection_period" {
6262
variable "commit_id" {
6363
default = "dummy_commit"
6464
}
65+
66+
variable "soaking_sample_app" {
67+
default = ""
68+
}

terraform/soaking/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ module "ec2_setup" {
2424
aoc_version = var.aoc_version
2525
region = var.region
2626

27+
sample_app_mode = var.sample_app_mode
28+
soaking_sample_app = var.soaking_sample_app
2729
soaking_data_mode = var.soaking_data_mode
2830
soaking_data_rate = var.soaking_data_rate
2931
soaking_data_type = var.soaking_data_type

terraform/soaking/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ variable "soaking_data_rate" {
5656

5757
variable "soaking_data_type" {
5858
default = "otlp"
59-
}
59+
}
60+
61+
variable "soaking_sample_app" {
62+
default = ""
63+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3.8"
2+
services:
3+
mocked_server:
4+
image: ${mocked_server_image}
5+
ports:
6+
- "80:8080"
7+
- "443:443"
8+
deploy:
9+
resources:
10+
limits:
11+
memory: 1G
12+
ot-metric-emitter:
13+
image: ${sample_app_image}
14+
command: []
15+
ports:
16+
- ${sample_app_external_port}:${sample_app_listen_address_port}
17+
environment:
18+
METRICS_LOAD: ${rate}
19+
LISTEN_ADDRESS: ${listen_address}
20+
deploy:
21+
resources:
22+
limits:
23+
memory: 16G
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
validation_config="default-mocked-server-prometheus-validation.yml"
22

33
sample_app="prometheus"
4+
5+
soaking_sample_app="prometheus"
6+
7+
soaking_data_type="prometheus"
8+
9+
sample_app_mode="pull"

0 commit comments

Comments
 (0)