Skip to content

Commit a0a8277

Browse files
committed
* Update for MQ 9.3.5
* Update all vendored dependencies * Add metadata label configuration options * Update to Go 1.20 as baseline * Add EXPERIMENTAL OpenTelemetry emitter
1 parent b771e51 commit a0a8277

File tree

613 files changed

+220474
-3242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

613 files changed

+220474
-3242
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4+
### Feb 29 2024 (v5.5.4)
5+
* Update to MQ 9.3.5
6+
* Update all vendored dependencies
7+
* Add metadata label configuration options
8+
* Update to Go 1.20 as baseline
9+
* Add EXPERIMENTAL OpenTelemetry emitter
10+
411
### Nov 08 2023 (v5.5.2)
512
* Pick up latest mq-golang fixes
613

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ ARG EXPORTER=mq_prometheus
1515
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
1616
## ### ### ### ### ### ### BUILD ### ### ### ### ### ### ##
1717
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
18-
FROM golang:1.19 AS builder
18+
FROM golang:1.20 AS builder
1919

2020
ARG EXPORTER
2121
ENV EXPORTER=${EXPORTER} \
2222
ORG="github.com/ibm-messaging" \
2323
REPO="mq-metric-samples" \
24-
VRMF=9.3.4.0 \
24+
VRMF=9.3.5.0 \
2525
CGO_CFLAGS="-I/opt/mqm/inc/" \
2626
CGO_LDFLAGS_ALLOW="-Wl,-rpath.*" \
2727
genmqpkg_incnls=1 \
@@ -113,7 +113,7 @@ RUN buildStamp=`date +%Y%m%d-%H%M%S`; \
113113
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
114114
### ### ### ### ### ### ### RUN ### ### ### ### ### ### ###
115115
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
116-
FROM golang:1.19 AS runtime
116+
FROM golang:1.20 AS runtime
117117

118118
ARG EXPORTER
119119

Dockerfile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ARG BASE_IMAGE=ubuntu:20.04
1616
FROM $BASE_IMAGE
1717

1818
ARG GOPATH_ARG="/go"
19-
ARG GOVERSION=1.19
19+
ARG GOVERSION=1.20
2020
ARG GOARCH=amd64
2121
ARG MQARCH=X64
2222

@@ -61,7 +61,7 @@ RUN mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg \
6161
# Location of the downloadable MQ client package \
6262
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
6363
RDTAR="IBM-MQC-Redist-Linux${MQARCH}.tar.gz" \
64-
VRMF=9.3.4.0
64+
VRMF=9.3.5.0
6565

6666
# Install the MQ client from the Redistributable package. This also contains the
6767
# header files we need to compile against. Setup the subset of the package

Dockerfile.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN apt-get update \
3434
# Location of the downloadable MQ client package \
3535
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
3636
RDTAR="IBM-MQC-Redist-Linux${MQARCH}.tar.gz" \
37-
VRMF=9.3.4.0
37+
VRMF=9.3.5.0
3838

3939
# Install the MQ client from the Redistributable package. This also contains the
4040
# header files we need to compile against. Setup the subset of the package

README.md

Lines changed: 179 additions & 177 deletions
Large diffs are not rendered by default.

cmd/mq_aws/exporter.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ func Collect() error {
271271
tags["description"] = mqmetric.GetObjectDescription(key, ibmmq.MQOT_Q)
272272
tags["cluster"] = mqmetric.GetQueueAttribute(key, ibmmq.MQCA_CLUSTER_NAME)
273273
}
274+
addMetaLabels(tags)
274275

275276
pt, _ := newPoint(series+"."+elem.MetricName, t, float64(f), tags)
276277
bp.addPoint(pt)
@@ -314,6 +315,7 @@ func Collect() error {
314315
tags[mqmetric.ATTR_CHL_RQMNAME] = strings.TrimSpace(rqmName)
315316
tags[mqmetric.ATTR_CHL_CONNNAME] = strings.TrimSpace(connName)
316317
tags[mqmetric.ATTR_CHL_JOBNAME] = strings.TrimSpace(jobName)
318+
addMetaLabels(tags)
317319

318320
f := mqmetric.ChannelNormalise(attr, value.ValueInt64)
319321

@@ -349,6 +351,7 @@ func Collect() error {
349351
tags["usage"] = usage
350352
tags["description"] = mqmetric.GetObjectDescription(key, ibmmq.MQOT_Q)
351353
tags["cluster"] = mqmetric.GetQueueAttribute(key, ibmmq.MQCA_CLUSTER_NAME)
354+
addMetaLabels(tags)
352355

353356
f := mqmetric.QueueNormalise(attr, value.ValueInt64)
354357

@@ -376,6 +379,7 @@ func Collect() error {
376379
tags["topic"] = topicString
377380
tags["platform"] = platformString
378381
tags["type"] = topicStatusType
382+
addMetaLabels(tags)
379383

380384
f := mqmetric.TopicNormalise(attr, value.ValueInt64)
381385

@@ -408,6 +412,8 @@ func Collect() error {
408412
tags["subid"] = subId
409413
tags["subscription"] = subName
410414
tags["topic"] = topicString
415+
addMetaLabels(tags)
416+
411417
f := mqmetric.SubNormalise(attr, value.ValueInt64)
412418

413419
pt, _ := newPoint(series+"."+attr.MetricName, t, float64(f), tags)
@@ -439,6 +445,7 @@ func Collect() error {
439445
"cluster": clusterName,
440446
"qmtype": qmTypeString,
441447
}
448+
addMetaLabels(tags)
442449

443450
f := mqmetric.ClusterNormalise(attr, value.ValueInt64)
444451

@@ -469,6 +476,7 @@ func Collect() error {
469476
if hostname != mqmetric.DUMMY_STRING {
470477
tags["hostname"] = hostname
471478
}
479+
addMetaLabels(tags)
472480

473481
f := mqmetric.QueueManagerNormalise(attr, value.ValueInt64)
474482

@@ -499,6 +507,7 @@ func Collect() error {
499507
tags["bufferpool"] = bpId
500508
tags["location"] = bpLocation
501509
tags["pageclass"] = bpClass
510+
addMetaLabels(tags)
502511

503512
f := mqmetric.UsageNormalise(attr, value.ValueInt64)
504513

@@ -525,6 +534,8 @@ func Collect() error {
525534
}
526535
tags["pageset"] = psId
527536
tags["bufferpool"] = bpId
537+
addMetaLabels(tags)
538+
528539
f := mqmetric.UsageNormalise(attr, value.ValueInt64)
529540

530541
pt, _ := newPoint(series+"."+attr.MetricName, t, float64(f), tags)
@@ -554,6 +565,7 @@ func Collect() error {
554565
tags["description"] = mqmetric.GetObjectDescription(chlName, mqmetric.OT_CHANNEL_AMQP)
555566
tags[mqmetric.ATTR_CHL_CONNNAME] = strings.TrimSpace(connName)
556567
tags[mqmetric.ATTR_CHL_AMQP_CLIENT_ID] = clientId
568+
addMetaLabels(tags)
557569

558570
f := mqmetric.ChannelNormalise(attr, value.ValueInt64)
559571

@@ -620,3 +632,11 @@ func (c client) Put(bp *BatchPoints) error {
620632
_, err := c.svc.PutMetricData(params)
621633
return err
622634
}
635+
636+
func addMetaLabels(tags map[string]string) {
637+
if len(config.cf.MetadataTagsArray) > 0 {
638+
for i := 0; i < len(config.cf.MetadataTagsArray); i++ {
639+
tags[config.cf.MetadataTagsArray[i]] = config.cf.MetadataValuesArray[i]
640+
}
641+
}
642+
}

cmd/mq_coll/exporter.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ func Collect() error {
225225
tags["description"] = mqmetric.GetObjectDescription(key, ibmmq.MQOT_Q)
226226
tags["cluster"] = mqmetric.GetQueueAttribute(key, ibmmq.MQCA_CLUSTER_NAME)
227227
}
228+
addMetaLabels(tags)
229+
228230
printPoint(series, elem.MetricName, float32(f), tags)
229231
}
230232
}
@@ -257,6 +259,7 @@ func Collect() error {
257259
tags[mqmetric.ATTR_CHL_RQMNAME] = strings.TrimSpace(rqmName)
258260
tags[mqmetric.ATTR_CHL_CONNNAME] = strings.TrimSpace(connName)
259261
tags[mqmetric.ATTR_CHL_JOBNAME] = strings.TrimSpace(jobName)
262+
addMetaLabels(tags)
260263

261264
f := mqmetric.ChannelNormalise(attr, value.ValueInt64)
262265
printPoint(series, attr.MetricName, float32(f), tags)
@@ -288,6 +291,7 @@ func Collect() error {
288291
tags["usage"] = usage
289292
tags["description"] = mqmetric.GetObjectDescription(key, ibmmq.MQOT_Q)
290293
tags["cluster"] = mqmetric.GetQueueAttribute(key, ibmmq.MQCA_CLUSTER_NAME)
294+
addMetaLabels(tags)
291295

292296
f := mqmetric.QueueNormalise(attr, value.ValueInt64)
293297
printPoint(series, attr.MetricName, float32(f), tags)
@@ -309,6 +313,7 @@ func Collect() error {
309313
tags["topic"] = topicString
310314
tags["platform"] = platformString
311315
tags["type"] = topicStatusType
316+
addMetaLabels(tags)
312317

313318
f := mqmetric.TopicNormalise(attr, value.ValueInt64)
314319
printPoint(series, attr.MetricName, float32(f), tags)
@@ -335,6 +340,8 @@ func Collect() error {
335340
tags["subid"] = subId
336341
tags["subscription"] = subName
337342
tags["topic"] = topicString
343+
addMetaLabels(tags)
344+
338345
f := mqmetric.SubNormalise(attr, value.ValueInt64)
339346
printPoint(series, attr.MetricName, float32(f), tags)
340347
}
@@ -359,6 +366,7 @@ func Collect() error {
359366
"qmtype": qmTypeString,
360367
"platform": platformString,
361368
}
369+
addMetaLabels(tags)
362370

363371
f := mqmetric.ClusterNormalise(attr, value.ValueInt64)
364372
printPoint(series, attr.MetricName, float32(f), tags)
@@ -382,6 +390,7 @@ func Collect() error {
382390
if hostname != mqmetric.DUMMY_STRING {
383391
tags["hostname"] = hostname
384392
}
393+
addMetaLabels(tags)
385394

386395
f := mqmetric.QueueManagerNormalise(attr, value.ValueInt64)
387396
printPoint(series, attr.MetricName, float32(f), tags)
@@ -406,6 +415,7 @@ func Collect() error {
406415
tags["bufferpool"] = bpId
407416
tags["location"] = bpLocation
408417
tags["pageclass"] = bpClass
418+
addMetaLabels(tags)
409419

410420
f := mqmetric.UsageNormalise(attr, value.ValueInt64)
411421
printPoint(series, attr.MetricName, float32(f), tags)
@@ -426,6 +436,8 @@ func Collect() error {
426436
}
427437
tags["pageset"] = psId
428438
tags["bufferpool"] = bpId
439+
addMetaLabels(tags)
440+
429441
f := mqmetric.UsageNormalise(attr, value.ValueInt64)
430442
printPoint(series, attr.MetricName, float32(f), tags)
431443
}
@@ -449,6 +461,7 @@ func Collect() error {
449461
tags["description"] = mqmetric.GetObjectDescription(chlName, mqmetric.OT_CHANNEL_AMQP)
450462
tags[mqmetric.ATTR_CHL_CONNNAME] = strings.TrimSpace(connName)
451463
tags[mqmetric.ATTR_CHL_AMQP_CLIENT_ID] = clientId
464+
addMetaLabels(tags)
452465

453466
f := mqmetric.ChannelNormalise(attr, value.ValueInt64)
454467
printPoint(series, attr.MetricName, float32(f), tags)
@@ -515,3 +528,11 @@ func sanitiseString(s string) string {
515528
}
516529
return s2
517530
}
531+
532+
func addMetaLabels(tags map[string]string) {
533+
if len(config.cf.MetadataTagsArray) > 0 {
534+
for i := 0; i < len(config.cf.MetadataTagsArray); i++ {
535+
tags[config.cf.MetadataTagsArray[i]] = config.cf.MetadataValuesArray[i]
536+
}
537+
}
538+
}

0 commit comments

Comments
 (0)