Skip to content

Commit ad68129

Browse files
atoulmegithub-actions[bot]otelbot[bot]breedx-splk
authored
[ibm-mq-metrics] Connection errors counter (#2122)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: otelbot <[email protected]> Co-authored-by: jason plumb <[email protected]>
1 parent 4fb5169 commit ad68129

File tree

9 files changed

+393
-0
lines changed

9 files changed

+393
-0
lines changed

ibm-mq-metrics/docs/metrics.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,3 +799,19 @@
799799
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
800800
|---|---|---|---|---|---|
801801
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
802+
803+
804+
805+
## Metric `ibm.mq.connection.errors`
806+
807+
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
808+
| -------- | --------------- | ----------- | -------------- | --------- |
809+
| `ibm.mq.connection.errors` | Counter | `{errors}` | Number of connection errors | ![Development](https://img.shields.io/badge/-development-blue) |
810+
811+
812+
### `ibm.mq.connection.errors` Attributes
813+
814+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
815+
|---|---|---|---|---|---|
816+
| `error.code` | string | The reason code associated with an error | `2038`; `2543`; `2009` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
817+
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |

ibm-mq-metrics/model/attributes.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,9 @@ groups:
7373
note: This is duplicated from otel semantic-conventions.
7474
stability: development
7575
examples: [ "Wordle", "JMSService" ]
76+
- id: error.code
77+
type: string
78+
brief: >
79+
The reason code associated with an error
80+
stability: development
81+
examples: [ "2038", "2543", "2009" ]

ibm-mq-metrics/model/metrics.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,3 +609,15 @@ groups:
609609
attributes:
610610
- ref: ibm.mq.queue.manager
611611
requirement_level: required
612+
- id: ibm.mq.connection.errors
613+
type: metric
614+
metric_name: ibm.mq.connection.errors
615+
stability: development
616+
brief: "Number of connection errors"
617+
instrument: counter
618+
unit: "{errors}"
619+
attributes:
620+
- ref: ibm.mq.queue.manager
621+
requirement_level: required
622+
- ref: error.code
623+
requirement_level: required

ibm-mq-metrics/src/integrationTest/java/io/opentelemetry/ibm/mq/integration/tests/WMQMonitorIntegrationTest.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import com.ibm.mq.headers.pcf.PCFException;
1919
import com.ibm.mq.headers.pcf.PCFMessage;
2020
import com.ibm.mq.headers.pcf.PCFMessageAgent;
21+
import io.opentelemetry.api.common.AttributeKey;
22+
import io.opentelemetry.api.common.Attributes;
2123
import io.opentelemetry.api.metrics.Meter;
2224
import io.opentelemetry.ibm.mq.config.QueueManager;
2325
import io.opentelemetry.ibm.mq.opentelemetry.ConfigWrapper;
@@ -281,4 +283,33 @@ void test_otlphttp() throws Exception {
281283
// reads a value from the heartbeat gauge
282284
assertThat(metricNames).contains("ibm.mq.heartbeat");
283285
}
286+
287+
@Test
288+
void test_bad_connection() throws Exception {
289+
logger.info("\n\n\n\n\n\nRunning test: test_bad_connection");
290+
String configFile = getConfigFile("conf/test-bad-config.yml");
291+
292+
ConfigWrapper config = ConfigWrapper.parse(configFile);
293+
Meter meter = otelTesting.getOpenTelemetry().getMeter("opentelemetry.io/mq");
294+
TestWMQMonitor monitor = new TestWMQMonitor(config, meter, service);
295+
monitor.runTest();
296+
297+
List<MetricData> data = otelTesting.getMetrics();
298+
299+
assertThat(data).isNotEmpty();
300+
assertThat(data).hasSize(2);
301+
302+
Attributes attrs = null;
303+
for (MetricData metricData : data) {
304+
if ("ibm.mq.connection.errors".equals(metricData.getName())) {
305+
attrs = metricData.getData().getPoints().stream().iterator().next().getAttributes();
306+
}
307+
}
308+
309+
assertThat(attrs).isNotNull();
310+
311+
String value = attrs.get(AttributeKey.stringKey("error.code"));
312+
313+
assertThat(value).isEqualTo("2538");
314+
}
284315
}
Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
queueManagers:
2+
- name: "QM1"
3+
host: "localhost"
4+
port: 1417
5+
6+
#The transport type for the queue manager connection, the default is "Bindings" for a binding type connection
7+
#For bindings type, connection WMQ extension (i.e machine agent) need to be on the same machine on which WebbsphereMQ server is running
8+
#For client type, connection change it to "Client".
9+
transportType: "Client"
10+
11+
#Channel name of the queue manager, channel should be server-conn type.
12+
#This field is not required in case of transportType: Bindings
13+
channelName: DEV.ADMIN.SVRCONN
14+
15+
#for user access level, please check "Access Permissions" section on the extensions page
16+
#comment out the username and password in case of transportType: Bindings.
17+
username: "admin"
18+
password: "passw0rd"
19+
20+
queueFilters:
21+
#Can provide complete queue name or generic names. A generic name is a character string followed by an asterisk (*),
22+
#for example ABC*, and it selects all objects having names that start with the selected character string.
23+
#An asterisk on its own matches all possible names.
24+
include: ["*"]
25+
exclude:
26+
#type value: STARTSWITH, EQUALS, ENDSWITH, CONTAINS
27+
- type: "STARTSWITH"
28+
#The name of the queue or queue name pattern as per queue filter, comma separated values
29+
values: ["SYSTEM","AMQ"]
30+
31+
32+
channelFilters:
33+
#Can provide complete channel name or generic names. A generic name is a character string followed by an asterisk (*),
34+
#for example ABC*, and it selects all objects having names that start with the selected character string.
35+
#An asterisk on its own matches all possible names.
36+
include: ["*"]
37+
exclude:
38+
#type value: STARTSWITH, EQUALS, ENDSWITH, CONTAINS
39+
- type: "STARTSWITH"
40+
#The name of the queue or queue name pattern as per queue filter, comma separated values
41+
values: ["SYSTEM"]
42+
43+
listenerFilters:
44+
#Can provide complete channel name or generic names. A generic name is a character string followed by an asterisk (*),
45+
#for example ABC*, and it selects all objects having names that start with the selected character string.
46+
#An asterisk on its own matches all possible names.
47+
include: ["*"]
48+
exclude:
49+
#type value: STARTSWITH, EQUALS, ENDSWITH, CONTAINS
50+
- type: "STARTSWITH"
51+
#The name of the queue or queue name pattern as per queue filter, comma separated values
52+
values: ["SYSTEM"]
53+
54+
topicFilters:
55+
# For topics, IBM MQ uses the topic wildcard characters ('#' and '+') and does not treat a trailing asterisk as a wildcard
56+
# https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.pla.doc/q005020_.htm
57+
include: ["#"]
58+
exclude:
59+
#type value: STARTSWITH, EQUALS, ENDSWITH, CONTAINS
60+
- type: "STARTSWITH"
61+
#The name of the queue or queue name pattern as per queue filter, comma separated values
62+
values: ["SYSTEM","$SYS"]
63+
64+
mqMetrics:
65+
# This Object will extract queue manager metrics
66+
- metricsType: "queueMgrMetrics"
67+
metrics:
68+
include:
69+
- Status:
70+
alias: "Status"
71+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_Q_MGR_STATUS"
72+
aggregationType: "OBSERVATION"
73+
timeRollUpType: "AVERAGE"
74+
clusterRollUpType: "INDIVIDUAL"
75+
- ConnectionCount:
76+
alias: "ConnectionCount"
77+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_CONNECTION_COUNT"
78+
79+
- ReusableLogSize:
80+
alias: "Reusable Log Size"
81+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_REUSABLE_LOG_SIZE"
82+
ibmCommand: "MQCMD_INQUIRE_Q_MGR_STATUS"
83+
84+
- RestartLogSize:
85+
alias: "Restart Log Size"
86+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_RESTART_LOG_SIZE"
87+
ibmCommand: "MQCMD_INQUIRE_Q_MGR_STATUS"
88+
89+
- ArchiveLogSize:
90+
alias: "Archive Log Size"
91+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_ARCHIVE_LOG_SIZE"
92+
ibmCommand: "MQCMD_INQUIRE_Q_MGR_STATUS"
93+
94+
- StatisticsInterval:
95+
alias: "Statistics Interval"
96+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_STATISTICS_INTERVAL"
97+
ibmCommand: "MQCMD_INQUIRE_Q_MGR"
98+
99+
# This Object will extract queue metrics
100+
- metricsType: "queueMetrics"
101+
metrics:
102+
include:
103+
- MaxQueueDepth:
104+
alias: "Max Queue Depth"
105+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_MAX_Q_DEPTH"
106+
ibmCommand: "MQCMD_INQUIRE_Q"
107+
108+
- CurrentQueueDepth:
109+
alias: "Current Queue Depth"
110+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_CURRENT_Q_DEPTH"
111+
ibmCommand: "MQCMD_INQUIRE_Q"
112+
113+
- CurrentQueueFileSize:
114+
alias: "Current queue file size"
115+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_CUR_Q_FILE_SIZE"
116+
ibmCommand: "MQCMD_INQUIRE_Q_STATUS"
117+
118+
- MaxQueueFileSize:
119+
alias: "Current maximum queue file size"
120+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_CUR_MAX_FILE_SIZE"
121+
ibmCommand: "MQCMD_INQUIRE_Q_STATUS"
122+
123+
- OpenInputCount:
124+
alias: "Open Input Count"
125+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_OPEN_INPUT_COUNT"
126+
ibmCommand: "MQCMD_INQUIRE_Q"
127+
128+
- OpenOutputCount:
129+
alias: "Open Output Count"
130+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_OPEN_OUTPUT_COUNT"
131+
ibmCommand: "MQCMD_INQUIRE_Q"
132+
133+
- OldestMsgAge:
134+
alias: "OldestMsgAge"
135+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_OLDEST_MSG_AGE"
136+
ibmCommand: "MQCMD_INQUIRE_Q_STATUS"
137+
aggregationType: "OBSERVATION"
138+
timeRollUpType: "CURRENT"
139+
clusterRollUpType: "INDIVIDUAL"
140+
141+
- UncommittedMsgs:
142+
alias: "UncommittedMsgs"
143+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_UNCOMMITTED_MSGS"
144+
ibmCommand: "MQCMD_INQUIRE_Q_STATUS"
145+
146+
- OnQTime:
147+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_Q_TIME_INDICATOR"
148+
ibmCommand: "MQCMD_INQUIRE_Q_STATUS"
149+
aggregationType: "OBSERVATION"
150+
timeRollUpType: "CURRENT"
151+
clusterRollUpType: "INDIVIDUAL"
152+
153+
- HighQDepth:
154+
alias: "HighQDepth"
155+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_HIGH_Q_DEPTH"
156+
ibmCommand: "MQCMD_RESET_Q_STATS"
157+
158+
- MsgDeqCount:
159+
alias: "MsgDeqCount"
160+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_MSG_DEQ_COUNT"
161+
ibmCommand: "MQCMD_RESET_Q_STATS"
162+
163+
- MsgEnqCount:
164+
alias: "MsgEnqCount"
165+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_MSG_ENQ_COUNT"
166+
ibmCommand: "MQCMD_RESET_Q_STATS"
167+
168+
- UncommittedMsgs:
169+
alias: "Uncommitted Messages"
170+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACF_UNCOMMITTED_MSGS"
171+
ibmCommand: "MQCMD_INQUIRE_Q_STATUS"
172+
173+
- ServiceInterval:
174+
alias: "Service Interval"
175+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_Q_SERVICE_INTERVAL"
176+
ibmCommand: "MQCMD_INQUIRE_Q"
177+
178+
- ServiceIntervalEvent:
179+
alias: "Service Interval Event"
180+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_Q_SERVICE_INTERVAL_EVENT"
181+
ibmCommand: "MQCMD_INQUIRE_Q"
182+
183+
# This Object will extract channel metrics
184+
- metricsType: "channelMetrics"
185+
metrics:
186+
include:
187+
- Messages:
188+
alias: "Messages"
189+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MSGS"
190+
ibmCommand: "MQCMD_INQUIRE_CHANNEL_STATUS"
191+
192+
- Status:
193+
alias: "Status"
194+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_CHANNEL_STATUS" #http://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q090880_.htm
195+
aggregationType: "OBSERVATION"
196+
timeRollUpType: "AVERAGE"
197+
clusterRollUpType: "INDIVIDUAL"
198+
ibmCommand: "MQCMD_INQUIRE_CHANNEL_STATUS"
199+
200+
- ByteSent:
201+
alias: "Byte Sent"
202+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_BYTES_SENT"
203+
ibmCommand: "MQCMD_INQUIRE_CHANNEL_STATUS"
204+
205+
- ByteReceived:
206+
alias: "Byte Received"
207+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_BYTES_RECEIVED"
208+
ibmCommand: "MQCMD_INQUIRE_CHANNEL_STATUS"
209+
210+
- BuffersSent:
211+
alias: "Buffers Sent"
212+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_BUFFERS_SENT"
213+
ibmCommand: "MQCMD_INQUIRE_CHANNEL_STATUS"
214+
215+
- BuffersReceived:
216+
alias: "Buffers Received"
217+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_BUFFERS_RECEIVED"
218+
ibmCommand: "MQCMD_INQUIRE_CHANNEL_STATUS"
219+
220+
- CurrentSharingConversations:
221+
alias: "Current Sharing Conversations"
222+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_CURRENT_SHARING_CONVS"
223+
224+
- MaxSharingConversations:
225+
alias: "Max Sharing Conversations"
226+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MAX_SHARING_CONVS"
227+
228+
- MaxInstances:
229+
alias: "Max Instances"
230+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MAX_INSTANCES"
231+
ibmCommand: "MQCMD_INQUIRE_CHANNEL"
232+
233+
- MaxInstancesPerClient:
234+
alias: "Max Instances per Client"
235+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MAX_INSTS_PER_CLIENT"
236+
ibmCommand: "MQCMD_INQUIRE_CHANNEL"
237+
238+
- MsgRetryCount:
239+
alias: "Message Retry Count"
240+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MR_COUNT"
241+
ibmCommand: "MQCMD_INQUIRE_CHANNEL"
242+
243+
- MsgsReceived:
244+
alias: "Message Received Count"
245+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MSGS_RECEIVED"
246+
ibmCommand: "MQCMD_INQUIRE_CHANNEL"
247+
248+
- MsgsSent:
249+
alias: "Message Sent"
250+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_MSGS_SENT"
251+
ibmCommand: "MQCMD_INQUIRE_CHANNEL"
252+
253+
- metricsType: "listenerMetrics"
254+
metrics:
255+
include:
256+
- Status:
257+
alias: "Status"
258+
ibmConstant: "com.ibm.mq.constants.CMQCFC.MQIACH_LISTENER_STATUS"
259+
aggregationType: "OBSERVATION"
260+
timeRollUpType: "AVERAGE"
261+
clusterRollUpType: "INDIVIDUAL"
262+
263+
# This Object will extract topic metrics
264+
- metricsType: "topicMetrics"
265+
metrics:
266+
include:
267+
- PublishCount:
268+
alias: "Publish Count"
269+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_PUB_COUNT"
270+
ibmCommand: "MQCMD_INQUIRE_TOPIC_STATUS"
271+
- SubscriptionCount:
272+
alias: "Subscription Count"
273+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_SUB_COUNT"
274+
ibmCommand: "MQCMD_INQUIRE_TOPIC_STATUS"
275+
276+
# Sets up reading configuration events from the configuration queue.
277+
- metricsType: "configurationMetrics"
278+
metrics:
279+
include:
280+
- MaxHandles:
281+
alias: "Max Handles"
282+
ibmConstant: "com.ibm.mq.constants.CMQC.MQIA_MAX_HANDLES"
283+
284+
#Run it as a scheduled task instead of running every minute.
285+
#If you want to run this every minute, comment this out
286+
#taskSchedule:
287+
# numberOfThreads: 1
288+
# taskDelaySeconds: 300
289+
290+
291+
sslConnection:
292+
trustStorePath: ""
293+
trustStorePassword: ""
294+
trustStoreEncryptedPassword: ""
295+
296+
keyStorePath: ""
297+
keyStorePassword: ""
298+
keyStoreEncryptedPassword: ""
299+
300+
# Configure the OTLP exporter using system properties keys following the specification https://opentelemetry.io/docs/languages/java/configuration/
301+
otlpExporter:
302+
otel.exporter.otlp.endpoint: http://0.0.0.0:4318

0 commit comments

Comments
 (0)