Skip to content

Commit

Permalink
add debug cat for apm-server logs
Browse files Browse the repository at this point in the history
  • Loading branch information
1pkg committed Sep 13, 2024
1 parent 434226f commit 458c466
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
GOBENCH_USERNAME: ${{ secrets.GOBENCH_USERNAME }}
GOBENCH_HOST: ${{ secrets.GOBENCH_HOST }}
# temporarily override to get faster feedback
BENCHMARK_WARMUP_TIME: 5m
BENCHMARK_WARMUP_TIME: 1m
BENCHMARK_COUNT: 2
BENCHMARK_TIME: 1m
steps:
Expand Down Expand Up @@ -142,6 +142,10 @@ jobs:
if: ${{ inputs.benchmarkAgents != '' }}
run: make run-benchmark

- name: Cat APM Server logs
if: failure()
run: make cat-apm-server-logs

# Results are only indexed and uploaded if the run happens on the main branch.

- name: Index benchmarks result
Expand Down
2 changes: 1 addition & 1 deletion systemtest/cmd/moxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func handler(logger *zap.Logger, username, password string) http.Handler {
zap.String("actual", string(actualAuth)),
zap.String("expected", expectedAuth),
)
// w.WriteHeader(http.StatusUnauthorized)
w.WriteHeader(http.StatusUnauthorized)
return
}
switch r.URL.Path {
Expand Down
5 changes: 5 additions & 0 deletions testing/benchmark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SSH_USER ?= ec2-user
SSH_OPTS ?= -o LogLevel=ERROR -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=10
SSH_KEY ?= ~/.ssh/id_rsa_terraform
WORKER_IP = $(shell terraform output -raw public_ip)
APM_SERVER_IP = $(shell terraform output -raw apm_server_ip)

SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c
Expand Down Expand Up @@ -134,6 +135,10 @@ _default-gobench-vars:
$(eval GOBENCH_DEFAULT_TAGS = $(GOBENCH_DEFAULT_TAGS),elasticsearch_zone_count=$(shell echo var.elasticsearch_zone_count | terraform console | tr -d '"'))
$(eval GOBENCH_DEFAULT_TAGS = $(GOBENCH_DEFAULT_TAGS),build_sha=$(shell curl -sL -H "Authorization: Bearer $(shell terraform output -raw apm_secret_token )" $(shell terraform output -raw apm_server_url ) | jq -r '.build_sha'))

.PHONY: cat-apm-server-logs
cat-apm-server-logs:
@ssh $(SSH_OPTS) -i $(SSH_KEY) $(SSH_USER)@$(APM_SERVER_IP) "cat /var/log/apm-server/*"

$(SSH_KEY):
@ssh-keygen -t rsa -b 4096 -C "$(USER)@elastic.co" -N "" -f $(SSH_KEY)

Expand Down
6 changes: 6 additions & 0 deletions testing/benchmark/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ output "apm_server_url" {
sensitive = true
}

output "apm_server_ip" {
value = var.run_standalone ? module.standalone_apm_server[0].apm_server_ip : ""
description = "The APM Server EC2 IP address"
sensitive = true
}

output "admin_console_url" {
value = !var.run_standalone ? module.ec_deployment[0].admin_console_url : ""
description = "The admin console URL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ output "apm_server_url" {
value = "http://${aws_instance.apm.public_ip}:${local.apm_port}"
description = "The APM Server URL"
}

output "apm_server_ip" {
value = aws_instance.apm.public_ip
description = "The APM Server EC2 IP address"
}

0 comments on commit 458c466

Please sign in to comment.