diff --git a/.chloggen/hostmetricsreceiver_process_scraper_freebsd.yaml b/.chloggen/hostmetricsreceiver_process_scraper_freebsd.yaml new file mode 100644 index 0000000000000..49befc1dffb70 --- /dev/null +++ b/.chloggen/hostmetricsreceiver_process_scraper_freebsd.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: hostmetricsreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Possible to enable the process scraper under FreeBSD in the hostmetrics receiver. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [39622] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/hostmetricsreceiver/README.md b/receiver/hostmetricsreceiver/README.md index dad647fef1494..24574599ee59a 100644 --- a/receiver/hostmetricsreceiver/README.md +++ b/receiver/hostmetricsreceiver/README.md @@ -47,8 +47,8 @@ The available scrapers are: | [memory] | All | Memory utilization metrics | | [network] | All | Network interface I/O metrics & TCP connection metrics | | [paging] | All | Paging/Swap space utilization and I/O metrics | -| [processes] | Linux, Mac | Process count metrics | -| [process] | Linux, Windows, Mac | Per process CPU, Memory, and Disk I/O metrics | +| [processes] | Linux, Mac, FreeBSD, OpenBSD | Process count metrics | +| [process] | Linux, Windows, Mac, FreeBSD | Per process CPU, Memory, and Disk I/O metrics | | [system] | Linux, Windows, Mac | Miscellaneous system metrics | [cpu]: ./internal/scraper/cpuscraper/documentation.md diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go index 0a73f7a36f933..2afb0249fcb43 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go @@ -44,8 +44,8 @@ func createMetricsScraper( settings scraper.Settings, cfg component.Config, ) (scraper.Metrics, error) { - if runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin" { - return nil, errors.New("process scraper only available on Linux, Windows, or macOS") + if runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin" && runtime.GOOS != "freebsd" { + return nil, errors.New("process scraper only available on Linux, Windows, macOS, or FreeBSD") } s, err := newProcessScraper(settings, cfg.(*Config)) diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory_test.go index b87cbca6195ba..dfab57edf166d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory_test.go @@ -26,7 +26,7 @@ func TestCreateResourceMetricsScraper(t *testing.T) { scraper, err := factory.CreateMetrics(context.Background(), scrapertest.NewNopSettings(metadata.Type), cfg) - if runtime.GOOS == "linux" || runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + if runtime.GOOS == "linux" || runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "freebsd" { assert.NoError(t, err) assert.NotNil(t, scraper) } else { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_bsds.go similarity index 98% rename from receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go rename to receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_bsds.go index de98262ed6bbb..6de7a5d04bab4 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_bsds.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -//go:build darwin +//go:build darwin || freebsd package processscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper" diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go index 624d8a4990335..521857d7ecb0c 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -//go:build !linux && !windows && !darwin +//go:build !linux && !windows && !darwin && !freebsd package processscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper"