Skip to content

Commit 62ab7aa

Browse files
committed
add a test, fix and smallchange in behaviour to allows us to capture apama-ctrl log lines and to allow for mroe flexibiltiy in userStatusLines
1 parent 13a53c9 commit 62ab7aa

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
3.7.dev
22
-------
3-
- TODO
3+
- It is not longer required for the prefix in userStatusLines to end with a ":".
44

55
3.6
66
---

README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ To do this create a .json configuration file containing a "userStatusLines" dici
7878
{
7979
"userStatusLines":{
8080
81-
// This is for a typical application-defined status line. Note that any text inside [...] brackets (
82-
// typically the monitor instance id) is ignored.
81+
// This is for a typical application-defined status line. Note that any number (or text) inside [...] brackets (
82+
// typically the monitor instance id) is ignored. This is matched against the "message" part of the log line,
83+
// which follows the first " - " in the line (except for [apama-ctrl] messages which have an extra <apama-ctrl> prefix)
8384
"com.mycompany.MyMonitor [1] MyApplication Status:": {
8485
// This prefix is added to the start of each alias to avoid clashes with other status KPIs
8586
"keyPrefix":"myApp.",

apamax/log_analyzer.py

-2
Original file line numberDiff line numberDiff line change
@@ -2229,8 +2229,6 @@ def main(self, args):
22292229
# sanity check it
22302230
columns = {k or COLUMN_DISPLAY_NAMES[k] for k in COLUMN_DISPLAY_NAMES}
22312231
for userStatusPrefix, userStatus in v.items():
2232-
if not userStatusPrefix.endswith(':'): raise UserError('userStatus prefixes should end with a ":"')
2233-
22342232
for k, alias in userStatus['key:alias'].items():
22352233
alias = userStatus['keyPrefix']+(alias or k)
22362234
if alias in columns: raise UserError(f"User status line '{userStatusPrefix}' contains display name '{alias}' which is already in use; consider using keyPrefix to ensure this status line doesn't conflict with display names from others")

tests/correctness/Cor_018/Input/analyzer_config.json

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{"userStatusLines":{
22

3+
4+
35
"com.mycompany.MyMonitor [1] MyApplication Status:": {
46
"keyPrefix":"myApp.",
57
"key:alias":{
@@ -8,6 +10,20 @@
810
"kpi3":""
911
}},
1012

13+
// since we munge the message for [apama-ctrl] lines we have a slightly different prefix needed
14+
"<apama-ctrl> com.apama.in_c8y.proxy.CepProxyServlet.run - ProxyStatus: addr=192.168.138.64 ": {
15+
"keyPrefix":"apama-ctrl.192.168.138.64.",
16+
"key:alias":{
17+
"started":"",
18+
"completed":""
19+
}},
20+
"<apama-ctrl> com.apama.in_c8y.proxy.CepProxyServlet.run - ProxyStatus: addr=192.168.146.0 ": {
21+
"keyPrefix":"apama-ctrl.192.168.146.0.",
22+
"key:alias":{
23+
"started":"",
24+
"completed":""
25+
}},
26+
1127
"JMS Status:": {
1228
"keyPrefix":"jms.",
1329
"key:alias":{

tests/correctness/Cor_018/Input/correlator.log

+3
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@
182182
2020-06-12 16:06:11.534 INFO [47556:Status] - JMSReceiver myConnection-receiver-apama-queue-01: rx=4 rRate=0 rWindow=97 rRedel=0 rMaxDeliverySecs=0.0 msgErrors=1 rDupsDet=1 perSourceDupIds=3 timeExpiryDupIds=0
183183
2020-06-12 16:06:11.534 INFO [47556:Status] - JMSReceiver myConnection-receiver-apama-topic-01: rx=0 rRate=0 rWindow=100 rRedel=0 rMaxDeliverySecs=0.0 msgErrors=0 rDupsDet=0 perSourceDupIds=0 timeExpiryDupIds=0
184184
2020-06-12 16:06:11.534 INFO [47556] - Persistence Status: numSnapshots=42 lastSnapshotTime=624772 snapshotWaitTimeEwmaMillis=0.03 commitTimeEwmaMillis=194.34 lastSnapshotRowsChangedEwma=93
185+
[apama-ctrl] 2020-06-17 20:15:47.342 INFO [Thread-5] com.apama.in_c8y.proxy.CepProxyServlet.run - ProxyStatus: addr=192.168.146.0 started=5 completed=3
186+
[apama-ctrl] 2020-06-17 20:15:47.342 INFO [Thread-5] com.apama.in_c8y.proxy.CepProxyServlet.run - ProxyStatus: addr=192.168.138.64 started=2 completed=2
187+
[apama-ctrl] 2020-06-17 20:15:47.342 INFO [Thread-5] com.apama.in_c8y.proxy.CepProxyServlet.run - ProxyStatus: addr=192.168.99.0 started=17 completed=17
185188
2020-06-12 16:06:11.600 CRIT [33128] - test.Test [2] Some sample EPL output
186189
2020-06-12 16:06:12.601 CRIT [33128] - test.Test [2] Some sample EPL output
187190
2020-06-12 16:06:13.600 CRIT [14100] - test.Test [2] Some sample EPL output

tests/correctness/Cor_018/Reference/user_status_final.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
myApp.kpi1=1585
22
myApp.kpi2AliasWithUnits=80.2
33
myApp.kpi3='abc def'
4+
apama-ctrl.192.168.138.64.started=2
5+
apama-ctrl.192.168.138.64.completed=2
6+
apama-ctrl.192.168.146.0.started=5
7+
apama-ctrl.192.168.146.0.completed=3
48
jms.s=senders=1
59
jms.r=receivers=2
610
jms.rx /sec=0

0 commit comments

Comments
 (0)