Skip to content

Commit 6a6de13

Browse files
committed
additional attribute constants
1 parent edf5e8b commit 6a6de13

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
import static com.ibm.mq.constants.CMQC.MQRC_SELECTOR_ERROR;
99
import static com.ibm.mq.constants.CMQCFC.MQRCCF_CHL_STATUS_NOT_FOUND;
10+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_CHANNEL_NAME;
11+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_CHANNEL_START_TIME;
12+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_CHANNEL_TYPE;
13+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_JOB_NAME;
1014
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_QUEUE_MANAGER;
1115

1216
import com.ibm.mq.constants.CMQC;
@@ -175,11 +179,11 @@ private void updateMetrics(
175179
throws PCFException {
176180
Attributes attributes =
177181
Attributes.builder()
178-
.put("channel.name", channelName)
179-
.put("channel.type", channelType)
180-
.put("queue.manager", context.getQueueManagerName())
181-
.put("channel.start.time", channelStartTime)
182-
.put("job.name", jobName)
182+
.put(IBM_MQ_CHANNEL_NAME, channelName)
183+
.put(IBM_MQ_CHANNEL_TYPE, channelType)
184+
.put(IBM_MQ_QUEUE_MANAGER, context.getQueueManagerName())
185+
.put(IBM_MQ_CHANNEL_START_TIME, channelStartTime)
186+
.put(IBM_MQ_JOB_NAME, jobName)
183187
.build();
184188
if (context.getMetricsConfig().isIbmMqMessageCountEnabled()) {
185189
int received = message.getIntParameterValue(CMQCFC.MQIACH_MSGS);

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
package io.opentelemetry.ibm.mq.metricscollector;
77

8+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_CHANNEL_NAME;
9+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_CHANNEL_TYPE;
10+
import static io.opentelemetry.ibm.mq.metrics.IbmMqAttributes.IBM_MQ_QUEUE_MANAGER;
11+
812
import com.ibm.mq.constants.CMQCFC;
913
import com.ibm.mq.constants.MQConstants;
1014
import com.ibm.mq.headers.pcf.MQCFIL;
@@ -106,9 +110,9 @@ private void updateMetrics(
106110
throws PCFException {
107111
Attributes attributes =
108112
Attributes.builder()
109-
.put("channel.name", channelName)
110-
.put("channel.type", channelType)
111-
.put("queue.manager", context.getQueueManagerName())
113+
.put(IBM_MQ_CHANNEL_NAME, channelName)
114+
.put(IBM_MQ_CHANNEL_TYPE, channelType)
115+
.put(IBM_MQ_QUEUE_MANAGER, context.getQueueManagerName())
112116
.build();
113117
if (context.getMetricsConfig().isIbmMqMaxInstancesEnabled()
114118
&& message.getParameter(CMQCFC.MQIACH_MAX_INSTANCES) != null) {

ibm-mq-metrics/src/test/java/io/opentelemetry/ibm/mq/metricscollector/QueueCollectionBuddyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void testProcessPcfRequestAndPublishQMetricsForInquireQStatusCmd() throws Except
6767
collectorContext, request, "*", InquireQStatusCmdCollector.ATTRIBUTES);
6868

6969
Map<String, Map<String, Long>> expectedValues =
70-
new HashMap<String, Map<String, Long>>(
70+
new HashMap<>(
7171
ImmutableMap.of(
7272
"DEV.DEAD.LETTER.QUEUE",
7373
new HashMap<>(
@@ -78,7 +78,7 @@ void testProcessPcfRequestAndPublishQMetricsForInquireQStatusCmd() throws Except
7878
"ibm.mq.onqtime.2", -1L,
7979
"ibm.mq.queue.depth", 0L)),
8080
"DEV.QUEUE.1",
81-
new HashMap<String, Long>(
81+
new HashMap<>(
8282
ImmutableMap.of(
8383
"ibm.mq.oldest.msg.age", -1L,
8484
"ibm.mq.uncommitted.messages", 10L,

0 commit comments

Comments
 (0)