Skip to content

Commit 0bfbc37

Browse files
committed
Address comments
Signed-off-by: Ying WANG <[email protected]>
1 parent b8300bc commit 0bfbc37

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

CHANGELOG.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Unreleased
22

3-
* [ENHANCEMENT] process_collector: Add Platform-Specific Describe for processCollector. #1625
4-
53
## 1.20.2 / 2024-08-23
64

75
* [BUGFIX] promhttp: Unset Content-Encoding header when data is uncompressed. #1596

prometheus/process_collector.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,18 @@ func NewProcessCollector(opts ProcessCollectorOpts) Collector {
125125
c.collectFn = c.processCollect
126126
c.describeFn = c.describe
127127
} else {
128-
c.collectFn = c.defaultCollectFn
129-
c.describeFn = c.defaultDescribeFn
128+
c.collectFn = c.errorCollectFn
129+
c.describeFn = c.errorDescribeFn
130130
}
131131

132132
return c
133133
}
134134

135-
func (c *processCollector) defaultCollectFn(ch chan<- Metric) {
135+
func (c *processCollector) errorCollectFn(ch chan<- Metric) {
136136
c.reportError(ch, nil, errors.New("process metrics not supported on this platform"))
137137
}
138138

139-
func (c *processCollector) defaultDescribeFn(ch chan<- *Desc) {
139+
func (c *processCollector) errorDescribeFn(ch chan<- *Desc) {
140140
if c.reportErrors {
141141
ch <- NewInvalidDesc(errors.New("process metrics not supported on this platform"))
142142
}

prometheus/process_collector_js.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ func canCollectProcess() bool {
2525
// in the processCollect method. Any changes to the metrics in processCollect
2626
// (such as adding or removing metrics) should be reflected in this list of descriptors.
2727
func (c *processCollector) processCollect(ch chan<- Metric) {
28-
c.defaultCollect(ch)
28+
c.errorCollectFn(ch)
2929
}
3030

3131
func (c *processCollector) describe(ch chan<- *Desc) {
32-
c.defaultDescribe(ch)
32+
c.errorDescribeFn(ch)
3333
}

prometheus/process_collector_wasip1.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ func canCollectProcess() bool {
2121
}
2222

2323
func (c *processCollector) processCollect(ch chan<- Metric) {
24-
c.defaultCollect(ch)
24+
c.errorCollectFn(ch)
2525
}
2626

2727
// describe returns all descriptions of the collector for wasip1.
2828
// Ensure that this list of descriptors is kept in sync with the metrics collected
2929
// in the processCollect method. Any changes to the metrics in processCollect
3030
// (such as adding or removing metrics) should be reflected in this list of descriptors.
3131
func (c *processCollector) describe(ch chan<- *Desc) {
32-
c.defaultDescribe(ch)
32+
c.errorDescribeFn(ch)
3333
}

0 commit comments

Comments
 (0)