Skip to content

Commit 9107498

Browse files
authored
Merge pull request #154 from signalfx/add_channel_type
add channel.type to all channel metrics
2 parents bdd7c59 + 838dfa3 commit 9107498

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

golden/data/expected.yaml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ resourceMetrics:
99
- key: channel.name
1010
value:
1111
stringValue: DEV.ADMIN.SVRCONN
12+
- key: channel.type
13+
value:
14+
stringValue: server-connection
1215
- key: queue.manager
1316
value:
1417
stringValue: QM1
@@ -19,6 +22,9 @@ resourceMetrics:
1922
- key: channel.name
2023
value:
2124
stringValue: DEV.APP.SVRCONN
25+
- key: channel.type
26+
value:
27+
stringValue: server-connection
2228
- key: queue.manager
2329
value:
2430
stringValue: QM1
@@ -423,6 +429,9 @@ resourceMetrics:
423429
- key: channel.name
424430
value:
425431
stringValue: DEV.ADMIN.SVRCONN
432+
- key: channel.type
433+
value:
434+
stringValue: server-connection
426435
- key: queue.manager
427436
value:
428437
stringValue: QM1
@@ -433,6 +442,9 @@ resourceMetrics:
433442
- key: channel.name
434443
value:
435444
stringValue: DEV.APP.SVRCONN
445+
- key: channel.type
446+
value:
447+
stringValue: server-connection
436448
- key: queue.manager
437449
value:
438450
stringValue: QM1
@@ -501,6 +513,9 @@ resourceMetrics:
501513
- key: channel.name
502514
value:
503515
stringValue: DEV.ADMIN.SVRCONN
516+
- key: channel.type
517+
value:
518+
stringValue: server-connection
504519
- key: queue.manager
505520
value:
506521
stringValue: QM1
@@ -511,6 +526,9 @@ resourceMetrics:
511526
- key: channel.name
512527
value:
513528
stringValue: DEV.APP.SVRCONN
529+
- key: channel.type
530+
value:
531+
stringValue: server-connection
514532
- key: queue.manager
515533
value:
516534
stringValue: QM1
@@ -579,6 +597,9 @@ resourceMetrics:
579597
- key: channel.name
580598
value:
581599
stringValue: DEV.ADMIN.SVRCONN
600+
- key: channel.type
601+
value:
602+
stringValue: server-connection
582603
- key: queue.manager
583604
value:
584605
stringValue: QM1
@@ -589,6 +610,9 @@ resourceMetrics:
589610
- key: channel.name
590611
value:
591612
stringValue: DEV.APP.SVRCONN
613+
- key: channel.type
614+
value:
615+
stringValue: server-connection
592616
- key: queue.manager
593617
value:
594618
stringValue: QM1
@@ -624,7 +648,7 @@ resourceMetrics:
624648
name: mq.connection.count
625649
- gauge:
626650
dataPoints:
627-
- asInt: "11600"
651+
- asInt: "17160"
628652
attributes:
629653
- key: channel.name
630654
value:
@@ -651,7 +675,7 @@ resourceMetrics:
651675
name: mq.manager.status
652676
- gauge:
653677
dataPoints:
654-
- asInt: "30284"
678+
- asInt: "73080"
655679
attributes:
656680
- key: channel.name
657681
value:
@@ -968,7 +992,7 @@ resourceMetrics:
968992
name: mq.service.interval
969993
- gauge:
970994
dataPoints:
971-
- asInt: "50"
995+
- asInt: "114"
972996
attributes:
973997
- key: channel.name
974998
value:
@@ -1140,6 +1164,9 @@ resourceMetrics:
11401164
- key: channel.name
11411165
value:
11421166
stringValue: DEV.ADMIN.SVRCONN
1167+
- key: channel.type
1168+
value:
1169+
stringValue: server-connection
11431170
- key: queue.manager
11441171
value:
11451172
stringValue: QM1
@@ -1150,6 +1177,9 @@ resourceMetrics:
11501177
- key: channel.name
11511178
value:
11521179
stringValue: DEV.APP.SVRCONN
1180+
- key: channel.type
1181+
value:
1182+
stringValue: server-connection
11531183
- key: queue.manager
11541184
value:
11551185
stringValue: QM1
@@ -1158,7 +1188,7 @@ resourceMetrics:
11581188
name: mq.max.instances
11591189
- gauge:
11601190
dataPoints:
1161-
- asInt: "45"
1191+
- asInt: "109"
11621192
attributes:
11631193
- key: channel.name
11641194
value:
@@ -1240,7 +1270,7 @@ resourceMetrics:
12401270
name: mq.manager.max.active.channels
12411271
- gauge:
12421272
dataPoints:
1243-
- asInt: "49"
1273+
- asInt: "113"
12441274
attributes:
12451275
- key: channel.name
12461276
value:

src/main/java/com/splunk/ibm/mq/metricscollector/InquireChannelCmdCollector.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ public void run() {
113113

114114
for (PCFMessage message : messages) {
115115
String channelName = MessageBuddy.channelName(message);
116+
String channelType = MessageBuddy.channelType(message);
116117
logger.debug("Pulling out metrics for channel name {}", channelName);
117-
updateMetrics(message, channelName);
118+
updateMetrics(message, channelName, channelType);
118119
}
119120
} catch (PCFException pcfe) {
120121
if (pcfe.getReason() == MQConstants.MQRCCF_CHL_STATUS_NOT_FOUND) {
@@ -140,13 +141,16 @@ public void run() {
140141
logger.debug("Time taken to publish metrics for all channels is {} milliseconds", exitTime);
141142
}
142143

143-
private void updateMetrics(PCFMessage message, String channelName) throws PCFException {
144+
private void updateMetrics(PCFMessage message, String channelName, String channelType)
145+
throws PCFException {
144146
Attributes attributes =
145147
Attributes.of(
146148
AttributeKey.stringKey("channel.name"),
147149
channelName,
148150
AttributeKey.stringKey("queue.manager"),
149-
context.getQueueManagerName());
151+
context.getQueueManagerName(),
152+
AttributeKey.stringKey("channel.type"),
153+
channelType);
150154
{
151155
int maxInstances = message.getIntParameterValue(CMQCFC.MQIACH_MAX_INSTANCES);
152156
this.maxClientsGauge.set(maxInstances, attributes);

src/test/java/com/splunk/ibm/mq/metricscollector/InquireChannelCmdCollectorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.fasterxml.jackson.databind.ObjectMapper;
2323
import com.google.common.collect.Lists;
2424
import com.ibm.mq.constants.CMQCFC;
25+
import com.ibm.mq.constants.CMQXC;
2526
import com.ibm.mq.headers.pcf.PCFMessage;
2627
import com.ibm.mq.headers.pcf.PCFMessageAgent;
2728
import com.splunk.ibm.mq.config.QueueManager;
@@ -102,6 +103,7 @@ public void testProcessPCFRequestAndPublishQMetricsForInquireQStatusCmd() throws
102103
private PCFMessage[] createPCFResponseForInquireChannelCmd() {
103104
PCFMessage response1 = new PCFMessage(2, CMQCFC.MQCMD_INQUIRE_CHANNEL, 1, true);
104105
response1.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "my.channel");
106+
response1.addParameter(CMQCFC.MQIACH_CHANNEL_TYPE, CMQXC.MQCHT_SVRCONN);
105107
response1.addParameter(CMQCFC.MQIACH_MR_COUNT, 22);
106108
response1.addParameter(CMQCFC.MQIACH_MSGS_RECEIVED, 42);
107109
response1.addParameter(CMQCFC.MQIACH_MSGS_SENT, 64);

0 commit comments

Comments
 (0)