Skip to content

Commit

Permalink
Merge branch 'main' into hotrod
Browse files Browse the repository at this point in the history
  • Loading branch information
hellspawn679 authored Jul 17, 2024
2 parents 7ab6214 + c68136e commit 9d82e79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions examples/hotrod/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ func init() {

// onInitialize is called before the command is executed.
func onInitialize() {
jaegerclientenv2otel.MapJaegerToOtelEnvVars(logger)

zapOptions := []zap.Option{
zap.AddStacktrace(zapcore.FatalLevel),
zap.AddCallerSkip(1),
Expand All @@ -68,6 +66,9 @@ func onInitialize() {
)
}
logger, _ = zap.NewDevelopment(zapOptions...)

jaegerclientenv2otel.MapJaegerToOtelEnvVars(logger)

metricsFactory = prometheus.New().Namespace(metrics.NSOptions{Name: "hotrod", Tags: nil})

if config.MySQLGetDelay != fixDBConnDelay {
Expand Down
13 changes: 10 additions & 3 deletions scripts/spm-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,24 @@ validate_service_metrics() {
# Store the values in an array
mapfile -t metric_points < <(echo "$response" | jq -r '.metrics[0].metricPoints[].gaugeValue.doubleValue')
echo "Metric datapoints found for service '$service': " "${metric_points[@]}"
# Check that all values are non-zero
# Check that atleast some values are non-zero after the threshold
local non_zero_count=0
local expected_non_zero_count=3
local zero_count=0
local expected_max_zero_count=3
for value in "${metric_points[@]}"; do
if [[ $(echo "$value > 0.0" | bc) == "1" ]]; then
non_zero_count=$((non_zero_count + 1))
else
echo "❌ ERROR: Zero values not expected"
zero_count=$((zero_count + 1))
fi

if [[ $zero_count -gt $expected_max_zero_count ]]; then
echo "❌ ERROR: Zero values crossing threshold limit not expected (Threshold limit - '$expected_max_zero_count')"
return 1
fi
done
if [ $non_zero_count -lt 3 ]; then
if [ $non_zero_count -lt $expected_non_zero_count ]; then
echo "⏳ Expecting at least 3 non-zero data points"
return 1
fi
Expand Down

0 comments on commit 9d82e79

Please sign in to comment.