Skip to content

Commit 64e51f5

Browse files
authored
proccess_collector: add wasip1 stub (#1350)
* proccess_collector: add wasip1 stub This resolves build failures like this when using the wasip1 support: # github.com/prometheus/procfs ../../../go/pkg/mod/github.com/prometheus/[email protected]/fs_statfs_type.go:25:18: undefined: syscall.Statfs_t ../../../go/pkg/mod/github.com/prometheus/[email protected]/fs_statfs_type.go:26:17: undefined: syscall.Statfs See https://go.dev/blog/wasi. Signed-off-by: Stephan Renatus <[email protected]> * add build tags Signed-off-by: Stephan Renatus <[email protected]> --------- Signed-off-by: Stephan Renatus <[email protected]>
1 parent d81c33f commit 64e51f5

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

prometheus/process_collector_other.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !windows && !js
15-
// +build !windows,!js
14+
//go:build !windows && !js && !wasip1
15+
// +build !windows,!js,!wasip1
1616

1717
package prometheus
1818

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2023 The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build wasip1
15+
// +build wasip1
16+
17+
package prometheus
18+
19+
func canCollectProcess() bool {
20+
return false
21+
}
22+
23+
func (*processCollector) processCollect(chan<- Metric) {
24+
// noop on this platform
25+
return
26+
}

0 commit comments

Comments
 (0)