From 9c67f6190c621b9c07bdee7fbab56aa1e0c6b6b7 Mon Sep 17 00:00:00 2001 From: Ying WANG <74549700+ying-jeanne@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:32:03 +0200 Subject: [PATCH] process_collector: Merge wasip1 and js into a single implementation (#1644) Signed-off-by: Ying WANG --- prometheus/process_collector_js.go | 33 ------------------- ...sip1.go => process_collector_wasip1_js.go} | 6 ++-- 2 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 prometheus/process_collector_js.go rename prometheus/{process_collector_wasip1.go => process_collector_wasip1_js.go} (95%) diff --git a/prometheus/process_collector_js.go b/prometheus/process_collector_js.go deleted file mode 100644 index 0b42a6f..0000000 --- a/prometheus/process_collector_js.go +++ /dev/null @@ -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) -} diff --git a/prometheus/process_collector_wasip1.go b/prometheus/process_collector_wasip1_js.go similarity index 95% rename from prometheus/process_collector_wasip1.go rename to prometheus/process_collector_wasip1_js.go index 5c74c2c..c68f7f8 100644 --- a/prometheus/process_collector_wasip1.go +++ b/prometheus/process_collector_wasip1_js.go @@ -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.