From 0173f453040d03282f55dd072d829a6d4e4e6a00 Mon Sep 17 00:00:00 2001 From: Braydon Kains <93549768+braydonk@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:42:38 -0500 Subject: [PATCH] [receiver/hostmetrics]: change uptime scraper to system scraper (#36123) #### Description This PR makes some changes that I had hoped to suggest on #35954, however I was unable to make my comment in time before the PR was merged. The changes this PR makes are: * The `uptime` scraper is changed to be named `system` * The scraper is registered using the scraper name when adding to the scrapercontroller #### Link to tracking issue Amends the fix to #31627 (following a comment I made on #35932) #### Testing #### Documentation The documentation that was added for the `uptime` scraper was renamed accordingly, and the description adjusted. --- .chloggen/add-hostmetric-system-uptime.yaml | 4 ++-- receiver/hostmetricsreceiver/README.md | 12 +++++----- receiver/hostmetricsreceiver/config_test.go | 6 ++--- receiver/hostmetricsreceiver/factory.go | 4 ++-- .../hostmetrics_receiver_test.go | 7 +++--- .../config.go | 4 ++-- .../{uptimescraper => systemscraper}/doc.go | 2 +- .../documentation.md | 2 +- .../factory.go | 17 +++++++++----- .../scraper/systemscraper/factory_test.go | 23 +++++++++++++++++++ .../internal/metadata/generated_config.go | 4 ++-- .../metadata/generated_config_test.go | 0 .../internal/metadata/generated_metrics.go | 2 +- .../metadata/generated_metrics_test.go | 0 .../internal/metadata/testdata/config.yaml | 0 .../metadata.yaml | 2 +- .../package_test.go | 2 +- .../system_scraper.go} | 4 ++-- .../system_scraper_test.go} | 4 ++-- .../hostmetricsreceiver/testdata/config.yaml | 2 +- 20 files changed, 65 insertions(+), 36 deletions(-) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/config.go (78%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/doc.go (67%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/documentation.md (93%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/factory.go (76%) create mode 100644 receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory_test.go rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/internal/metadata/generated_config.go (91%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/internal/metadata/generated_config_test.go (100%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/internal/metadata/generated_metrics.go (98%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/internal/metadata/generated_metrics_test.go (100%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/internal/metadata/testdata/config.yaml (100%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/metadata.yaml (86%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper => systemscraper}/package_test.go (89%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper/uptime.go => systemscraper/system_scraper.go} (91%) rename receiver/hostmetricsreceiver/internal/scraper/{uptimescraper/uptime_test.go => systemscraper/system_scraper_test.go} (94%) diff --git a/.chloggen/add-hostmetric-system-uptime.yaml b/.chloggen/add-hostmetric-system-uptime.yaml index 296b5a311edc..a4d3bbafc52a 100644 --- a/.chloggen/add-hostmetric-system-uptime.yaml +++ b/.chloggen/add-hostmetric-system-uptime.yaml @@ -5,7 +5,7 @@ change_type: enhancement component: hostmetricsreceiver # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add an uptime scraper in the hostmetrics receiver +note: Add the system.uptime metric 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: [31627] @@ -13,7 +13,7 @@ issues: [31627] # (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: +subtext: This metric is provided by the new `system` scraper. # 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. diff --git a/receiver/hostmetricsreceiver/README.md b/receiver/hostmetricsreceiver/README.md index 398b30a9ae1d..a56fbbda3617 100644 --- a/receiver/hostmetricsreceiver/README.md +++ b/receiver/hostmetricsreceiver/README.md @@ -17,7 +17,7 @@ The Host Metrics receiver generates metrics about the host system scraped -from various sources and host entity event as log. This is intended to be +from various sources and host entity event as log. This is intended to be used when the collector is deployed as an agent. ## Getting Started @@ -49,7 +49,7 @@ The available scrapers are: | [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 | -| [uptime] | Linux, Windows, Mac | Uptime metric | +| [system] | Linux, Windows, Mac | Miscellaneous system metrics | [cpu]: ./internal/scraper/cpuscraper/documentation.md [disk]: ./internal/scraper/diskscraper/documentation.md @@ -60,7 +60,7 @@ The available scrapers are: [paging]: ./internal/scraper/pagingscraper/documentation.md [processes]: ./internal/scraper/processesscraper/documentation.md [process]: ./internal/scraper/processscraper/documentation.md -[uptime]: ./internal/scraper/uptimescraper/documentation.md +[system]: ./internal/scraper/systemscraper/documentation.md ### Notes @@ -172,14 +172,14 @@ service: Host metrics are collected from the Linux system directories on the filesystem. You likely want to collect metrics about the host system and not the container. -This is achievable by following these steps: +This is achievable by following these steps: #### 1. Bind mount the host filesystem -The simplest configuration is to mount the entire host filesystem when running +The simplest configuration is to mount the entire host filesystem when running the container. e.g. `docker run -v /:/hostfs ...`. -You can also choose which parts of the host filesystem to mount, if you know +You can also choose which parts of the host filesystem to mount, if you know exactly what you'll need. e.g. `docker run -v /proc:/hostfs/proc`. #### 2. Configure `root_path` diff --git a/receiver/hostmetricsreceiver/config_test.go b/receiver/hostmetricsreceiver/config_test.go index 2d00dab4b738..4b30d09a9622 100644 --- a/receiver/hostmetricsreceiver/config_test.go +++ b/receiver/hostmetricsreceiver/config_test.go @@ -27,7 +27,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processesscraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" ) func TestLoadConfig(t *testing.T) { @@ -119,8 +119,8 @@ func TestLoadConfig(t *testing.T) { cfg.SetEnvMap(common.EnvMap{}) return cfg })(), - uptimescraper.TypeStr: (func() internal.Config { - cfg := (&uptimescraper.Factory{}).CreateDefaultConfig() + systemscraper.TypeStr: (func() internal.Config { + cfg := (&systemscraper.Factory{}).CreateDefaultConfig() cfg.SetEnvMap(common.EnvMap{}) return cfg })(), diff --git a/receiver/hostmetricsreceiver/factory.go b/receiver/hostmetricsreceiver/factory.go index 227ef00862d1..dbd7458f4233 100644 --- a/receiver/hostmetricsreceiver/factory.go +++ b/receiver/hostmetricsreceiver/factory.go @@ -27,7 +27,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processesscraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" ) const ( @@ -46,7 +46,7 @@ var ( pagingscraper.TypeStr: &pagingscraper.Factory{}, processesscraper.TypeStr: &processesscraper.Factory{}, processscraper.TypeStr: &processscraper.Factory{}, - uptimescraper.TypeStr: &uptimescraper.Factory{}, + systemscraper.TypeStr: &systemscraper.Factory{}, } ) diff --git a/receiver/hostmetricsreceiver/hostmetrics_receiver_test.go b/receiver/hostmetricsreceiver/hostmetrics_receiver_test.go index 6919a4fe5e2f..993b08f95b7b 100644 --- a/receiver/hostmetricsreceiver/hostmetrics_receiver_test.go +++ b/receiver/hostmetricsreceiver/hostmetrics_receiver_test.go @@ -34,7 +34,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processesscraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" ) var allMetrics = []string{ @@ -82,7 +82,7 @@ var factories = map[string]internal.ScraperFactory{ pagingscraper.TypeStr: &pagingscraper.Factory{}, processesscraper.TypeStr: &processesscraper.Factory{}, processscraper.TypeStr: &processscraper.Factory{}, - uptimescraper.TypeStr: &uptimescraper.Factory{}, + systemscraper.TypeStr: &systemscraper.Factory{}, } type testEnv struct { @@ -404,7 +404,7 @@ func Benchmark_ScrapeUptimeMetrics(b *testing.B) { cfg := &Config{ ControllerConfig: scraperhelper.NewDefaultControllerConfig(), - Scrapers: map[string]internal.Config{uptimescraper.TypeStr: (&uptimescraper.Factory{}).CreateDefaultConfig()}, + Scrapers: map[string]internal.Config{systemscraper.TypeStr: (&systemscraper.Factory{}).CreateDefaultConfig()}, } benchmarkScrapeMetrics(b, cfg) @@ -444,6 +444,7 @@ func Benchmark_ScrapeSystemAndProcessMetrics(b *testing.B) { networkscraper.TypeStr: &networkscraper.Config{}, pagingscraper.TypeStr: (&pagingscraper.Factory{}).CreateDefaultConfig(), processesscraper.TypeStr: &processesscraper.Config{}, + systemscraper.TypeStr: &systemscraper.Config{}, }, } diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/config.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/config.go similarity index 78% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/config.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/config.go index 00bdcff6722d..9c101ad03347 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/config.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/config.go @@ -1,11 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package uptimescraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" +package systemscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata" ) // Config relating to Uptime Metric Scraper. diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/doc.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/doc.go similarity index 67% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/doc.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/doc.go index 256a95de192a..0ccd665b954d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/doc.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/doc.go @@ -3,4 +3,4 @@ //go:generate mdatagen metadata.yaml -package uptimescraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" +package systemscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/documentation.md b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/documentation.md similarity index 93% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/documentation.md rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/documentation.md index ce38e605d291..1238dd9db1db 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/documentation.md +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/documentation.md @@ -1,6 +1,6 @@ [comment]: <> (Code generated by mdatagen. DO NOT EDIT.) -# hostmetricsreceiver/uptime +# hostmetricsreceiver/system **Parent Component:** hostmetrics diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go similarity index 76% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/factory.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go index 9f957c33b2fb..bb7d540c7526 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go @@ -1,26 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package uptimescraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" +package systemscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" import ( "context" "errors" "runtime" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" - hostmeta "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/metadata" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata" ) -// This file implements Factory for Uptime scraper. +// This file implements Factory for System scraper. const ( // TypeStr the value of "type" key in configuration. - TypeStr = "uptime" + TypeStr = "system" +) + +var ( + // scraperType is the component type used for the built scraper. + scraperType component.Type = component.MustNewType(TypeStr) ) // Factory is the Factory for scraper. @@ -47,7 +52,7 @@ func (f *Factory) CreateMetricsScraper( uptimeScraper := newUptimeScraper(ctx, settings, cfg.(*Config)) return scraperhelper.NewScraper( - hostmeta.Type, + scraperType, uptimeScraper.scrape, scraperhelper.WithStart(uptimeScraper.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory_test.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory_test.go new file mode 100644 index 000000000000..5567d875bce2 --- /dev/null +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory_test.go @@ -0,0 +1,23 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package systemscraper + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestCreateSystemScraper(t *testing.T) { + factory := &Factory{} + cfg := &Config{} + + scraper, err := factory.CreateMetricsScraper(context.Background(), receivertest.NewNopSettings(), cfg) + + assert.NoError(t, err) + assert.NotNil(t, scraper) + assert.Equal(t, scraperType.String(), scraper.ID().String()) +} diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_config.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_config.go similarity index 91% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_config.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_config.go index f41b077ee334..f3a6f0c2be34 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_config.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_config.go @@ -25,7 +25,7 @@ func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error { return nil } -// MetricsConfig provides config for hostmetricsreceiver/uptime metrics. +// MetricsConfig provides config for hostmetricsreceiver/system metrics. type MetricsConfig struct { SystemUptime MetricConfig `mapstructure:"system.uptime"` } @@ -38,7 +38,7 @@ func DefaultMetricsConfig() MetricsConfig { } } -// MetricsBuilderConfig is a configuration for hostmetricsreceiver/uptime metrics builder. +// MetricsBuilderConfig is a configuration for hostmetricsreceiver/system metrics builder. type MetricsBuilderConfig struct { Metrics MetricsConfig `mapstructure:"metrics"` } diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_config_test.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_config_test.go similarity index 100% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_config_test.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_config_test.go diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_metrics.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_metrics.go similarity index 98% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_metrics.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_metrics.go index b586215338e1..653a4230e08f 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_metrics.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_metrics.go @@ -160,7 +160,7 @@ func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption) { rm := pmetric.NewResourceMetrics() rm.SetSchemaUrl(conventions.SchemaURL) ils := rm.ScopeMetrics().AppendEmpty() - ils.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper") + ils.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper") ils.Scope().SetVersion(mb.buildInfo.Version) ils.Metrics().EnsureCapacity(mb.metricsCapacity) mb.metricSystemUptime.emit(ils.Metrics()) diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_metrics_test.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_metrics_test.go similarity index 100% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/generated_metrics_test.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/generated_metrics_test.go diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/testdata/config.yaml b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/testdata/config.yaml similarity index 100% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata/testdata/config.yaml rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata/testdata/config.yaml diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/metadata.yaml b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/metadata.yaml similarity index 86% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/metadata.yaml rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/metadata.yaml index 311077a1af94..f58a53420ba7 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/metadata.yaml +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/metadata.yaml @@ -1,4 +1,4 @@ -type: hostmetricsreceiver/uptime +type: hostmetricsreceiver/system parent: hostmetrics diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/package_test.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/package_test.go similarity index 89% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/package_test.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/package_test.go index 6de26a8152d0..337c65274c8b 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/package_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/package_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package uptimescraper +package systemscraper import ( "testing" diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/uptime.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go similarity index 91% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/uptime.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go index db6d307c53c5..3d441eb0bc2b 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/uptime.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package uptimescraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper" +package systemscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper" import ( "context" @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata" ) // scraper for Uptime Metrics diff --git a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/uptime_test.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper_test.go similarity index 94% rename from receiver/hostmetricsreceiver/internal/scraper/uptimescraper/uptime_test.go rename to receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper_test.go index 1ceeebdd117c..38171c5a8cf1 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/uptime_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package uptimescraper +package systemscraper import ( "context" @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver/receivertest" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper/internal/metadata" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata" ) func TestScrape(t *testing.T) { diff --git a/receiver/hostmetricsreceiver/testdata/config.yaml b/receiver/hostmetricsreceiver/testdata/config.yaml index 2128c3dcbc41..fd882c9e6465 100644 --- a/receiver/hostmetricsreceiver/testdata/config.yaml +++ b/receiver/hostmetricsreceiver/testdata/config.yaml @@ -21,7 +21,7 @@ receivers: include: names: ["test2", "test3"] match_type: "regexp" - uptime: + system: processors: nop: