process_collector: Merge wasip1 and js into a single implementation (#1644)

Signed-off-by: Ying WANG <ying.wang@grafana.com>
This commit is contained in:
Ying WANG 2024-10-14 16:32:03 +02:00 committed by GitHub
parent 284ca0ff58
commit 9c67f6190c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 36 deletions

View File

@ -1,33 +0,0 @@
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build js
// +build js
package prometheus
func canCollectProcess() bool {
return false
}
// describe returns all descriptions of the collector for js.
// Ensure that this list of descriptors is kept in sync with the metrics collected
// in the processCollect method. Any changes to the metrics in processCollect
// (such as adding or removing metrics) should be reflected in this list of descriptors.
func (c *processCollector) processCollect(ch chan<- Metric) {
c.errorCollectFn(ch)
}
func (c *processCollector) describe(ch chan<- *Desc) {
c.errorDescribeFn(ch)
}

View File

@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build wasip1
// +build wasip1
//go:build wasip1 || js
// +build wasip1 js
package prometheus
@ -24,7 +24,7 @@ func (c *processCollector) processCollect(ch chan<- Metric) {
c.errorCollectFn(ch)
}
// describe returns all descriptions of the collector for wasip1.
// describe returns all descriptions of the collector for wasip1 and js.
// Ensure that this list of descriptors is kept in sync with the metrics collected
// in the processCollect method. Any changes to the metrics in processCollect
// (such as adding or removing metrics) should be reflected in this list of descriptors.