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

print all traces from tempo when e2e fails #2373

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions tests/common/traceql/all_traces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: e2e.tests.odigos.io/v1
kind: TraceTest
description: This query all the traces, and used for debugging
query: |
{name != "GET /actuator/health/**"}
expected:
minimum: 1
16 changes: 14 additions & 2 deletions tests/common/traceql_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function process_yaml_file() {
local dest_namespace="traces"
local dest_service="e2e-tests-tempo"
local dest_port="tempo-prom-metrics"
local verbose=$2

local file=$1
file_name=$(basename "$file")
Expand All @@ -44,7 +45,14 @@ function process_yaml_file() {
one_hour=3600
start_epoch=$(($current_epoch - one_hour))
end_epoch=$(($current_epoch + one_hour))

response=$(kubectl get --raw /api/v1/namespaces/$dest_namespace/services/$dest_service:$dest_port/proxy/api/search\?end=$end_epoch\&start=$start_epoch\&q=$encoded_query\&limit=50)
if [ "$verbose" == "true" ]; then
echo "==============Raw response from tempo===================="
echo "$response" | jq .traces
echo "========================================================="
fi

num_of_traces=$(echo $response | jq '.traces | length')

if [ "$expected_count" != "null" ]; then
Expand All @@ -71,12 +79,16 @@ function process_yaml_file() {

# Check if the first argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <traceql-test-file>"
echo "Usage: $0 <traceql-test-file> [--verbose]"
exit 1
fi

# Test file path
TEST_FILE=$1
VERBOSE=false
if [ "$2" == "--verbose" ]; then
VERBOSE=true
fi

# Check if yq is installed
if ! command -v yq &> /dev/null; then
Expand All @@ -85,4 +97,4 @@ if ! command -v yq &> /dev/null; then
fi

verify_yaml_schema $TEST_FILE
process_yaml_file $TEST_FILE
process_yaml_file $TEST_FILE $VERBOSE
4 changes: 4 additions & 0 deletions tests/e2e/cli-upgrade/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ spec:
sleep 5
fi
done
catch:
- script:
content: |
../../common/traceql_runner.sh ../../common/traceql/all_traces.yaml --verbose
- name: Verify Trace - Context Propagation
try:
- script:
Expand Down
Loading