Skip to content

Commit 7e1821c

Browse files
authored
Merge pull request #156 from signalfx/job_name
add job.name
2 parents 3868694 + 48a84c2 commit 7e1821c

File tree

5 files changed

+52
-15
lines changed

5 files changed

+52
-15
lines changed

golden/data/expected.yaml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ resourceMetrics:
4040
stringValue: DEV.ADMIN.SVRCONN
4141
- key: channel.start.time
4242
value:
43-
intValue: "1748458488"
43+
intValue: "1748462702"
4444
- key: channel.type
4545
value:
4646
stringValue: server-connection
47+
- key: job.name
48+
value:
49+
stringValue: "0000074900000003"
4750
- key: queue.manager
4851
value:
4952
stringValue: QM1
@@ -631,10 +634,13 @@ resourceMetrics:
631634
stringValue: DEV.ADMIN.SVRCONN
632635
- key: channel.start.time
633636
value:
634-
intValue: "1748458488"
637+
intValue: "1748462702"
635638
- key: channel.type
636639
value:
637640
stringValue: server-connection
641+
- key: job.name
642+
value:
643+
stringValue: "0000074900000003"
638644
- key: queue.manager
639645
value:
640646
stringValue: QM1
@@ -654,17 +660,20 @@ resourceMetrics:
654660
name: mq.connection.count
655661
- gauge:
656662
dataPoints:
657-
- asInt: "17168"
663+
- asInt: "11612"
658664
attributes:
659665
- key: channel.name
660666
value:
661667
stringValue: DEV.ADMIN.SVRCONN
662668
- key: channel.start.time
663669
value:
664-
intValue: "1748458488"
670+
intValue: "1748462702"
665671
- key: channel.type
666672
value:
667673
stringValue: server-connection
674+
- key: job.name
675+
value:
676+
stringValue: "0000074900000003"
668677
- key: queue.manager
669678
value:
670679
stringValue: QM1
@@ -684,17 +693,20 @@ resourceMetrics:
684693
name: mq.manager.status
685694
- gauge:
686695
dataPoints:
687-
- asInt: "73080"
696+
- asInt: "30284"
688697
attributes:
689698
- key: channel.name
690699
value:
691700
stringValue: DEV.ADMIN.SVRCONN
692701
- key: channel.start.time
693702
value:
694-
intValue: "1748458488"
703+
intValue: "1748462702"
695704
- key: channel.type
696705
value:
697706
stringValue: server-connection
707+
- key: job.name
708+
value:
709+
stringValue: "0000074900000003"
698710
- key: queue.manager
699711
value:
700712
stringValue: QM1
@@ -1004,17 +1016,20 @@ resourceMetrics:
10041016
name: mq.service.interval
10051017
- gauge:
10061018
dataPoints:
1007-
- asInt: "114"
1019+
- asInt: "50"
10081020
attributes:
10091021
- key: channel.name
10101022
value:
10111023
stringValue: DEV.ADMIN.SVRCONN
10121024
- key: channel.start.time
10131025
value:
1014-
intValue: "1748458488"
1026+
intValue: "1748462702"
10151027
- key: channel.type
10161028
value:
10171029
stringValue: server-connection
1030+
- key: job.name
1031+
value:
1032+
stringValue: "0000074900000003"
10181033
- key: queue.manager
10191034
value:
10201035
stringValue: QM1
@@ -1031,10 +1046,13 @@ resourceMetrics:
10311046
stringValue: DEV.ADMIN.SVRCONN
10321047
- key: channel.start.time
10331048
value:
1034-
intValue: "1748458488"
1049+
intValue: "1748462702"
10351050
- key: channel.type
10361051
value:
10371052
stringValue: server-connection
1053+
- key: job.name
1054+
value:
1055+
stringValue: "0000074900000003"
10381056
- key: queue.manager
10391057
value:
10401058
stringValue: QM1
@@ -1206,17 +1224,20 @@ resourceMetrics:
12061224
name: mq.max.instances
12071225
- gauge:
12081226
dataPoints:
1209-
- asInt: "109"
1227+
- asInt: "45"
12101228
attributes:
12111229
- key: channel.name
12121230
value:
12131231
stringValue: DEV.ADMIN.SVRCONN
12141232
- key: channel.start.time
12151233
value:
1216-
intValue: "1748458488"
1234+
intValue: "1748462702"
12171235
- key: channel.type
12181236
value:
12191237
stringValue: server-connection
1238+
- key: job.name
1239+
value:
1240+
stringValue: "0000074900000003"
12201241
- key: queue.manager
12211242
value:
12221243
stringValue: QM1
@@ -1291,17 +1312,20 @@ resourceMetrics:
12911312
name: mq.manager.max.active.channels
12921313
- gauge:
12931314
dataPoints:
1294-
- asInt: "113"
1315+
- asInt: "49"
12951316
attributes:
12961317
- key: channel.name
12971318
value:
12981319
stringValue: DEV.ADMIN.SVRCONN
12991320
- key: channel.start.time
13001321
value:
1301-
intValue: "1748458488"
1322+
intValue: "1748462702"
13021323
- key: channel.type
13031324
value:
13041325
stringValue: server-connection
1326+
- key: job.name
1327+
value:
1328+
stringValue: "0000074900000003"
13051329
- key: queue.manager
13061330
value:
13071331
stringValue: QM1

golden/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ services:
4242
--ignore-start-timestamp
4343
--timeout 2m
4444
--ignore-metric-attribute-value channel.start.time
45+
--ignore-metric-attribute-value job.name
4546
--ignore-resource-metrics-order
4647
--ignore-scope-metrics-order
4748
--ignore-metrics-order

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ public void run() {
146146
CMQCFC.MQIACH_CURRENT_SHARING_CONVS,
147147
CMQCFC.MQIACH_MAX_SHARING_CONVS,
148148
CMQCFC.MQCACH_CHANNEL_START_DATE,
149-
CMQCFC.MQCACH_CHANNEL_START_TIME
149+
CMQCFC.MQCACH_CHANNEL_START_TIME,
150+
CMQCFC.MQCACH_MCA_JOB_NAME
150151
};
151152
if (logger.isDebugEnabled()) {
152153
logger.debug(
@@ -192,9 +193,11 @@ public void run() {
192193
String channelName = MessageBuddy.channelName(message);
193194
String channelType = MessageBuddy.channelType(message);
194195
long channelStartTime = MessageBuddy.channelStartTime(message);
196+
String jobName = MessageBuddy.jobName(message);
195197

196198
logger.debug("Pulling out metrics for channel name {}", channelName);
197-
updateMetrics(message, channelName, channelType, channelStartTime, activeChannels);
199+
updateMetrics(
200+
message, channelName, channelType, channelStartTime, jobName, activeChannels);
198201
}
199202
} catch (PCFException pcfe) {
200203
if (pcfe.getReason() == MQRCCF_CHL_STATUS_NOT_FOUND) {
@@ -233,6 +236,7 @@ private void updateMetrics(
233236
String channelName,
234237
String channelType,
235238
long channelStartTime,
239+
String jobName,
236240
List<String> activeChannels)
237241
throws PCFException {
238242
Attributes attributes =
@@ -241,6 +245,7 @@ private void updateMetrics(
241245
.put("channel.type", channelType)
242246
.put("queue.manager", context.getQueueManagerName())
243247
.put("channel.start.time", channelStartTime)
248+
.put("job.name", jobName)
244249
.build();
245250
int received = message.getIntParameterValue(CMQCFC.MQIACH_MSGS);
246251
messageCountGauge.set(received, attributes);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,8 @@ public static long channelStartTime(PCFMessage message) throws PCFException {
7878
Instant parsed = Instant.parse(date + "T" + time.replaceAll("\\.", ":") + "Z");
7979
return parsed.getEpochSecond();
8080
}
81+
82+
public static String jobName(PCFMessage message) throws PCFException {
83+
return message.getStringParameterValue(CMQCFC.MQCACH_MCA_JOB_NAME).trim();
84+
}
8185
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ private PCFMessage[] createPCFResponseForInquireChannelStatusCmd() {
168168
response1.addParameter(CMQCFC.MQIACH_CHANNEL_SUBSTATE, 300);
169169
response1.addParameter(CMQCFC.MQCACH_CHANNEL_START_DATE, "2012-01-03");
170170
response1.addParameter(CMQCFC.MQCACH_CHANNEL_START_TIME, "22.33.44");
171+
response1.addParameter(CMQCFC.MQCACH_MCA_JOB_NAME, "000042040000000C");
171172

172173
PCFMessage response2 = new PCFMessage(2, CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS, 2, true);
173174
response2.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "DEV.APP.SVRCONN");
@@ -183,6 +184,7 @@ private PCFMessage[] createPCFResponseForInquireChannelStatusCmd() {
183184
response2.addParameter(CMQCFC.MQIACH_CHANNEL_SUBSTATE, 300);
184185
response2.addParameter(CMQCFC.MQCACH_CHANNEL_START_DATE, "2012-01-04");
185186
response2.addParameter(CMQCFC.MQCACH_CHANNEL_START_TIME, "22.33.45");
187+
response2.addParameter(CMQCFC.MQCACH_MCA_JOB_NAME, "000042040000000D");
186188

187189
PCFMessage response3 = new PCFMessage(2, CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS, 2, true);
188190
response3.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "TEST.APP.SVRCONN");
@@ -198,6 +200,7 @@ private PCFMessage[] createPCFResponseForInquireChannelStatusCmd() {
198200
response3.addParameter(CMQCFC.MQIACH_CHANNEL_SUBSTATE, 300);
199201
response3.addParameter(CMQCFC.MQCACH_CHANNEL_START_DATE, "2012-01-05");
200202
response3.addParameter(CMQCFC.MQCACH_CHANNEL_START_TIME, "22.33.46");
203+
response3.addParameter(CMQCFC.MQCACH_MCA_JOB_NAME, "000042040000000E");
201204

202205
return new PCFMessage[] {response1, response2, response3};
203206
}

0 commit comments

Comments
 (0)