Skip to content

Commit 7c18a2f

Browse files
authored
[ibm-mq] Add expired message metric for IBM MQ queues (#2809)
1 parent 52bd063 commit 7c18a2f

11 files changed

Lines changed: 106 additions & 38 deletions

File tree

ibm-mq-metrics/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ metrics:
142142
enabled: true
143143
"ibm.mq.queue.depth.low.event": # The number of low queue events
144144
enabled: true
145+
"ibm.mq.expired.messages": # Number of expired messages
146+
enabled: true
145147
"ibm.mq.uncommitted.messages": # Number of uncommitted messages
146148
enabled: true
147149
"ibm.mq.oldest.msg.age": # Queue message oldest age
@@ -212,4 +214,4 @@ sslConnection:
212214

213215
# Configure the OTLP exporter using system properties keys following the specification https://opentelemetry.io/docs/languages/java/configuration/
214216
otlpExporter:
215-
otel.exporter.otlp.endpoint: http://localhost:4318
217+
otel.exporter.otlp.endpoint: http://localhost:4318

ibm-mq-metrics/docs/metrics.md

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,25 @@
300300

301301

302302

303+
## Metric `ibm.mq.expired.messages`
304+
305+
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
306+
| -------- | --------------- | ----------- | -------------- | --------- |
307+
| `ibm.mq.expired.messages` | Gauge | `{message}` | Number of expired messages | ![Development](https://img.shields.io/badge/-development-blue) |
308+
309+
310+
### `ibm.mq.expired.messages` Attributes
311+
312+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
313+
|---|---|---|---|---|---|
314+
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
315+
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
316+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [8] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
317+
318+
**[8] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
319+
320+
321+
303322
## Metric `ibm.mq.uncommitted.messages`
304323

305324
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
@@ -313,9 +332,9 @@
313332
|---|---|---|---|---|---|
314333
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
315334
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
316-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [8] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
335+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [9] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
317336

318-
**[8] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
337+
**[9] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
319338

320339

321340

@@ -332,9 +351,9 @@
332351
|---|---|---|---|---|---|
333352
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
334353
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
335-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [9] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
354+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [10] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
336355

337-
**[9] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
356+
**[10] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
338357

339358

340359

@@ -351,9 +370,9 @@
351370
|---|---|---|---|---|---|
352371
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
353372
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
354-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [10] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
373+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [11] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
355374

356-
**[10] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
375+
**[11] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
357376

358377

359378

@@ -370,9 +389,9 @@
370389
|---|---|---|---|---|---|
371390
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
372391
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
373-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [11] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
392+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [12] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
374393

375-
**[11] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
394+
**[12] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
376395

377396

378397

@@ -389,9 +408,9 @@
389408
|---|---|---|---|---|---|
390409
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
391410
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
392-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [12] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
411+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [13] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
393412

394-
**[12] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
413+
**[13] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
395414

396415

397416

@@ -408,9 +427,9 @@
408427
|---|---|---|---|---|---|
409428
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
410429
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
411-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [13] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
430+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [14] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
412431

413-
**[13] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
432+
**[14] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
414433

415434

416435

@@ -427,9 +446,9 @@
427446
|---|---|---|---|---|---|
428447
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
429448
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
430-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [14] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
449+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [15] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
431450

432-
**[14] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
451+
**[15] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
433452

434453

435454

@@ -446,9 +465,9 @@
446465
|---|---|---|---|---|---|
447466
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
448467
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
449-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [15] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
468+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [16] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
450469

451-
**[15] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
470+
**[16] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
452471

453472

454473

@@ -465,9 +484,9 @@
465484
|---|---|---|---|---|---|
466485
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
467486
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
468-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [16] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
487+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [17] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
469488

470-
**[16] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
489+
**[17] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
471490

472491

473492

@@ -529,9 +548,9 @@
529548
|---|---|---|---|---|---|
530549
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
531550
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
532-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [17] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
551+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [18] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
533552

534-
**[17] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
553+
**[18] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
535554

536555

537556

@@ -548,9 +567,9 @@
548567
|---|---|---|---|---|---|
549568
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
550569
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
551-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [18] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
570+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [19] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
552571

553-
**[18] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
572+
**[19] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
554573

555574

556575

@@ -567,9 +586,9 @@
567586
|---|---|---|---|---|---|
568587
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
569588
| `ibm.mq.queue.type` | string | The queue type | `local-normal` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
570-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [19] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
589+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [20] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
571590

572-
**[19] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
591+
**[20] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
573592

574593

575594

@@ -726,9 +745,9 @@
726745
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
727746
|---|---|---|---|---|---|
728747
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
729-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [20] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
748+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [21] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
730749

731-
**[20] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
750+
**[21] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
732751

733752

734753

@@ -744,9 +763,9 @@
744763
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
745764
|---|---|---|---|---|---|
746765
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
747-
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [21] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
766+
| `messaging.destination.name` | string | The system-specific name of the messaging operation. [22] | `dev/` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
748767

749-
**[21] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
768+
**[22] `messaging.destination.name`:** This is duplicated from otel semantic-conventions.
750769

751770

752771

@@ -778,12 +797,12 @@
778797
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
779798
|---|---|---|---|---|---|
780799
| `ibm.mq.queue.manager` | string | The name of the IBM queue manager | `MQ1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
781-
| `service.name` | string | Logical name of the service. [22] | `Wordle`; `JMSService` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
782-
| `user.name` | string | Short name or login/username of the user. [23] | `foo`; `root` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
800+
| `service.name` | string | Logical name of the service. [23] | `Wordle`; `JMSService` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
801+
| `user.name` | string | Short name or login/username of the user. [24] | `foo`; `root` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
783802

784-
**[22] `service.name`:** This is duplicated from otel semantic-conventions.
803+
**[23] `service.name`:** This is duplicated from otel semantic-conventions.
785804

786-
**[23] `user.name`:** This is duplicated from otel semantic-conventions.
805+
**[24] `user.name`:** This is duplicated from otel semantic-conventions.
787806

788807

789808

ibm-mq-metrics/model/metrics.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,20 @@ groups:
249249
requirement_level: required
250250
- ref: messaging.destination.name
251251
requirement_level: required
252+
- id: ibm.mq.expired.messages
253+
type: metric
254+
metric_name: ibm.mq.expired.messages
255+
stability: development
256+
brief: "Number of expired messages"
257+
instrument: gauge
258+
unit: "{message}"
259+
attributes:
260+
- ref: ibm.mq.queue.manager
261+
requirement_level: required
262+
- ref: messaging.destination.name
263+
requirement_level: required
264+
- ref: ibm.mq.queue.type
265+
requirement_level: required
252266
- id: ibm.mq.uncommitted.messages
253267
type: metric
254268
metric_name: ibm.mq.uncommitted.messages

ibm-mq-metrics/src/integrationTest/resources/conf/test-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ metrics:
122122
enabled: true
123123
"ibm.mq.queue.depth.low.event": # The number of low queue events
124124
enabled: true
125+
"ibm.mq.expired.messages": # Number of expired messages
126+
enabled: true
125127
"ibm.mq.uncommitted.messages": # Number of uncommitted messages
126128
enabled: true
127129
"ibm.mq.oldest.msg.age": # Queue message oldest age

ibm-mq-metrics/src/integrationTest/resources/conf/test-queuemgr-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ metrics:
9494
enabled: true
9595
"ibm.mq.queue.depth.low.event": # The number of low queue events
9696
enabled: true
97+
"ibm.mq.expired.messages": # Number of expired messages
98+
enabled: true
9799
"ibm.mq.uncommitted.messages": # Number of uncommitted messages
98100
enabled: true
99101
"ibm.mq.oldest.msg.age": # Queue message oldest age

ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metrics/Metrics.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ public static LongCounter createIbmMqQueueDepthLowEvent(Meter meter) {
159159
.build();
160160
}
161161

162+
public static LongGauge createIbmMqExpiredMessages(Meter meter) {
163+
return meter
164+
.gaugeBuilder("ibm.mq.expired.messages")
165+
.ofLongs()
166+
.setUnit("{message}")
167+
.setDescription("Number of expired messages")
168+
.build();
169+
}
170+
162171
public static LongGauge createIbmMqUncommittedMessages(Meter meter) {
163172
return meter
164173
.gaugeBuilder("ibm.mq.uncommitted.messages")

ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metrics/MetricsConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public boolean isIbmMqQueueDepthLowEventEnabled() {
8383
return isEnabled("ibm.mq.queue.depth.low.event");
8484
}
8585

86+
public boolean isIbmMqExpiredMessagesEnabled() {
87+
return isEnabled("ibm.mq.expired.messages");
88+
}
89+
8690
public boolean isIbmMqUncommittedMessagesEnabled() {
8791
return isEnabled("ibm.mq.uncommitted.messages");
8892
}

ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/InquireQStatusCmdCollector.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ final class InquireQStatusCmdCollector implements Consumer<MetricsCollectorConte
3939
CMQCFC.MQIACF_CUR_MAX_FILE_SIZE,
4040
CMQCFC.MQIACF_OLDEST_MSG_AGE,
4141
CMQCFC.MQIACF_UNCOMMITTED_MSGS,
42+
CMQCFC.MQIACF_EXPIRY_Q_COUNT,
4243
CMQCFC.MQIACF_Q_TIME_INDICATOR,
4344
CMQC.MQIA_CURRENT_Q_DEPTH,
4445
};

ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/QueueCollectionBuddy.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ private static AllowedGauge createAllowedGauge(
108108
createAllowedGauge(
109109
Metrics.createIbmMqUncommittedMessages(meter),
110110
MetricsConfig::isIbmMqUncommittedMessagesEnabled));
111+
gauges.put(
112+
CMQCFC.MQIACF_EXPIRY_Q_COUNT,
113+
createAllowedGauge(
114+
Metrics.createIbmMqExpiredMessages(meter),
115+
MetricsConfig::isIbmMqExpiredMessagesEnabled));
111116
gauges.put(
112117
CMQC.MQIA_MSG_DEQ_COUNT,
113118
createAllowedGauge(

0 commit comments

Comments
 (0)