-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Addition of pcp2opentelemetry tool #1972
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
QA output created by 1827 | ||
pcp2openmetrics invocation | ||
pcp2openmetrics HTTP POST (sorted): | ||
INFO:root:Starting httpd... | ||
|
||
INFO:root:POST request, | ||
Path: / | ||
Headers: | ||
Host: localhost:PORT | ||
User-Agent: python-requests VERSION | ||
Accept: */* | ||
Content-Type: application/openmetrics-text | ||
Content-Length: SIZE | ||
|
||
|
||
|
||
|
||
|
||
# HELP hinv_ncpu number of CPUs in the system | ||
Body: | ||
# PCP5 hinv_ncpu 60.0.32 u32 PM_INDOM_NULL discrete | ||
# HELP hinv_ncpu b'number of CPUs in the system' | ||
# TYPE hinv_ncpu gauge | ||
Accept: */* | ||
Body: | ||
Content-Length: SIZE | ||
Content-Type: application/openmetrics-text | ||
Headers: | ||
Host: localhost:PORT | ||
INFO:root:POST request, | ||
INFO:root:Starting httpd... | ||
Path: / | ||
User-Agent: python-requests VERSION | ||
hinv_ncpu{domainname="DOMAINID",groupid="GROUPID",hostname="HOST",machineid="MACHINEID",userid="USERID",agent="linux"} N (cpus) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/sh | ||
# PCP QA Test No. 1827 | ||
# Exercise pcp2opentelemetry HTTP POST functionality. | ||
# | ||
# Copyright (c) 2024 Red Hat. All Rights Reserved. | ||
# | ||
|
||
|
||
seq=`basename $0` | ||
echo "QA output created by $seq" | ||
|
||
. ./common.python | ||
|
||
which pcp2opentelemetry >/dev/null 2>&1 || _notrun "pcp2opentelemetry not installed" | ||
|
||
|
||
_cleanup() | ||
{ | ||
cd $here | ||
$sudo rm -rf $tmp $tmp.* | ||
} | ||
|
||
status=0 # success is the default! | ||
cpus=`pmprobe -v hinv.ncpu | awk '{print $3}'` | ||
hostname=`hostname` | ||
machineid=`_machine_id` | ||
domainid=`_domain_name` | ||
$sudo rm -rf $tmp $tmp.* $seq.full | ||
trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
|
||
_filter_pcp2opentelemetry_http() | ||
{ | ||
tee -a $here/$seq.full \ | ||
| col -b \ | ||
| sed \ | ||
-e '/\"asDouble\":/ s/[0-9][0-9]*/NCPU/' \ | ||
-e 's/\"'$machineid'\"/MACHINEID/' \ | ||
-e 's/\"'$hostname'\"/HOSTNAME/' \ | ||
-e 's/\"'$domainid'\"/DOMAINID/' \ | ||
-e 's/\"agent\": .*/\"agent\": \"'$OSTYPE'\"/' \ | ||
-e 's/\"startTimeUnixNano\": .*/\"startTimeUnixNano\": TIME/' \ | ||
-e 's/\"userid\": .*/\"userid\": USERID/' \ | ||
-e 's/\"userid\": .*/\"userid\": GROUPID/' \ | ||
-e '/HTTP/d' | ||
} >> $tmp.python2.out | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this pattern is repeated in three or four tests now, let's make a _filter_python_http_reponse shell function in one of the qa/common.xxx files and share it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @natoscott should this go in a specific common.xxx file or make a new one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lmchilton lets put it in common.python |
||
|
||
# real QA test starts here | ||
port=`_find_free_port` | ||
$PCP_PYTHON_PROG $here/src/pythonserver.py $port >$tmp.python.out 2>&1 & | ||
pid=$! | ||
sleep 2 # let server start up | ||
|
||
|
||
echo "pcp2opentelemetry invocation" | tee -a $here/$seq.full | ||
pcp2opentelemetry -s1 -u http://localhost:$port/receive hinv.ncpu >$tmp.json.out 2>$tmp.openjson.err | ||
|
||
|
||
echo "pcp2opentelemetry HTTP POST (sorted):" | ||
_filter_pcp2opentelemetry_http <$tmp.python.out | ||
_check_http_filter <$tmp.python2.out | ||
|
||
|
||
# terminate pythonserver.py now | ||
pmsignal $pid >/dev/null 2>&1 | ||
|
||
# success, all done | ||
exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to upgrade your PCP python installation (./Makepkgs FTW) - this b'...' issue will be resolved then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natoscott I upgraded the packages, ran configure and make and still the b' issue was still there when I re ran the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that is a mystery - its definitely fixed for me (and in CI). I wonder if somehow an older version of the python library is being found somewhere on your system, unexpectedly.