Skip to content

Commit a2321e7

Browse files
authored
Merge pull request #2237 from prometheus/pick-1.3.1
Release 1.3.1
2 parents c65f870 + 6c5c3d1 commit a2321e7

8 files changed

+27
-11
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
* [ENHANCEMENT]
66
* [BUGFIX]
77

8+
* [ENHANCEMENT] Add node_softirqs_total metric #2221
9+
10+
## 1.3.1 / 2021-12-01
11+
12+
* [BUGFIX] Handle nil CPU thermal power status on M1 #2218
13+
* [BUGFIX] bsd: Ignore filesystems flagged as MNT_IGNORE. #2227
14+
* [BUGFIX] Sanitize UTF-8 in dmi collector #2229
15+
816
## 1.3.0 / 2021-10-20
917

1018
NOTE: In order to support globs in the textfile collector path, filenames exposed by

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
1.3.1

collector/dmi.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"errors"
2121
"fmt"
2222
"os"
23+
"strings"
2324

2425
"github.com/go-kit/log"
2526
"github.com/go-kit/log/level"
@@ -78,7 +79,7 @@ func NewDMICollector(logger log.Logger) (Collector, error) {
7879
} {
7980
if value != nil {
8081
labels = append(labels, label)
81-
values = append(values, *value)
82+
values = append(values, strings.ToValidUTF8(*value, "�"))
8283
}
8384
}
8485

collector/filesystem_freebsd.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ import (
2424
const (
2525
defMountPointsExcluded = "^/(dev)($|/)"
2626
defFSTypesExcluded = "^devfs$"
27-
readOnly = 0x1 // MNT_RDONLY
28-
noWait = 0x2 // MNT_NOWAIT
2927
)
3028

3129
// Expose filesystem fullness.
3230
func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
33-
n, err := unix.Getfsstat(nil, noWait)
31+
n, err := unix.Getfsstat(nil, unix.MNT_NOWAIT)
3432
if err != nil {
3533
return nil, err
3634
}
3735
buf := make([]unix.Statfs_t, n)
38-
_, err = unix.Getfsstat(buf, noWait)
36+
_, err = unix.Getfsstat(buf, unix.MNT_NOWAIT)
3937
if err != nil {
4038
return nil, err
4139
}
@@ -54,8 +52,13 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
5452
continue
5553
}
5654

55+
if (fs.Flags & unix.MNT_IGNORE) != 0 {
56+
level.Debug(c.logger).Log("msg", "Ignoring mount flagged as ignore", "mountpoint", mountpoint)
57+
continue
58+
}
59+
5760
var ro float64
58-
if (fs.Flags & readOnly) != 0 {
61+
if (fs.Flags & unix.MNT_RDONLY) != 0 {
5962
ro = 1
6063
}
6164

collector/fixtures/e2e-output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ node_disk_written_bytes_total{device="sr0"} 0
609609
node_disk_written_bytes_total{device="vda"} 1.0938236928e+11
610610
# HELP node_dmi_info A metric with a constant '1' value labeled by bios_date, bios_release, bios_vendor, bios_version, board_asset_tag, board_name, board_serial, board_vendor, board_version, chassis_asset_tag, chassis_serial, chassis_vendor, chassis_version, product_family, product_name, product_serial, product_sku, product_uuid, product_version, system_vendor if provided by DMI.
611611
# TYPE node_dmi_info gauge
612-
node_dmi_info{bios_date="04/12/2021",bios_release="2.2",bios_vendor="Dell Inc.",bios_version="2.2.4",board_name="07PXPY",board_serial=".7N62AI2.GRTCL6944100GP.",board_vendor="Dell Inc.",board_version="A01",chassis_asset_tag="",chassis_serial="7N62AI2",chassis_vendor="Dell Inc.",chassis_version="",product_family="PowerEdge",product_name="PowerEdge R6515",product_serial="7N62AI2",product_sku="SKU=NotProvided;ModelName=PowerEdge R6515",product_uuid="83340ca8-cb49-4474-8c29-d2088ca84dd9",product_version="",system_vendor="Dell Inc."} 1
612+
node_dmi_info{bios_date="04/12/2021",bios_release="2.2",bios_vendor="Dell Inc.",bios_version="2.2.4",board_name="07PXPY",board_serial=".7N62AI2.GRTCL6944100GP.",board_vendor="Dell Inc.",board_version="A01",chassis_asset_tag="",chassis_serial="7N62AI2",chassis_vendor="Dell Inc.",chassis_version="",product_family="PowerEdge",product_name="PowerEdge R6515",product_serial="7N62AI2",product_sku="SKU=NotProvided;ModelName=PowerEdge R6515",product_uuid="83340ca8-cb49-4474-8c29-d2088ca84dd9",product_version="�[�",system_vendor="Dell Inc."} 1
613613
# HELP node_drbd_activitylog_writes_total Number of updates of the activity log area of the meta data.
614614
# TYPE node_drbd_activitylog_writes_total counter
615615
node_drbd_activitylog_writes_total{device="drbd1"} 1100

collector/fixtures/sys.ttar

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Mode: 400
141141
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
142142
Path: sys/class/dmi/id/product_version
143143
Lines: 1
144-
144+
�[�
145145
Mode: 444
146146
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
147147
Path: sys/class/dmi/id/sys_vendor

collector/thermal_darwin.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ import "C"
4747
import (
4848
"errors"
4949
"fmt"
50+
"unsafe"
51+
5052
"github.com/go-kit/log"
5153
"github.com/prometheus/client_golang/prometheus"
52-
"unsafe"
5354
)
5455

5556
type thermCollector struct {
@@ -118,7 +119,9 @@ func (c *thermCollector) Update(ch chan<- prometheus.Metric) error {
118119
func fetchCPUPowerStatus() (map[string]int, error) {
119120
cfDictRef, _ := C.FetchThermal()
120121
defer func() {
121-
C.CFRelease(C.CFTypeRef(cfDictRef.ref))
122+
if cfDictRef.ref != 0x0 {
123+
C.CFRelease(C.CFTypeRef(cfDictRef.ref))
124+
}
122125
}()
123126

124127
if C.kIOReturnNotFound == cfDictRef.ret {

end-to-end-test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ enabled_collectors=$(cat << COLLECTORS
1111
cpu
1212
cpufreq
1313
diskstats
14+
dmi
1415
drbd
1516
edac
1617
entropy

0 commit comments

Comments
 (0)