Skip to content

[receiver/hostmetrics]: change uptime scraper to system scraper#36123

Merged
djaglowski merged 5 commits into
open-telemetry:mainfrom
braydonk:system_scraper
Nov 5, 2024
Merged

[receiver/hostmetrics]: change uptime scraper to system scraper#36123
djaglowski merged 5 commits into
open-telemetry:mainfrom
braydonk:system_scraper

Conversation

@braydonk
Copy link
Copy Markdown
Contributor

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.

This PR makes some changes that I had hoped to suggest on the PR that
introduced the uptime scraper, however I was unable to make my comment
in time before the PR was merged.

* The `uptime` scraper is changed to be named `system`
* The scraper is registered using the scraper name when adding to the
  scrapercontroller
@braydonk
Copy link
Copy Markdown
Contributor Author

I am ideally hoping that this change makes it in before a new OTel Collector is tagged so that no users start using uptime scrapers in their configs.

@braydonk
Copy link
Copy Markdown
Contributor Author

I would like to skip changelog, because in this case what I did was modified the existing changelog to reflect this new change.

@braydonk
Copy link
Copy Markdown
Contributor Author

@kevinnoel-be I am unable to officially add you as a reviewer on this PR, but if you have a second to take a look I would appreciate it!

Comment thread receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory_test.go Outdated
@kevinnoel-be
Copy link
Copy Markdown
Contributor

@braydonk looks good to me except for the use of one (test) module where I think it should be testify instead?

@atoulme atoulme added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Nov 1, 2024
Copy link
Copy Markdown
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, LGTM

@djaglowski djaglowski merged commit 219011b into open-telemetry:main Nov 5, 2024
@github-actions github-actions Bot added this to the next release milestone Nov 5, 2024
michael-burt pushed a commit to michael-burt/opentelemetry-collector-contrib that referenced this pull request Nov 7, 2024
…-telemetry#36123)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes some changes that I had hoped to suggest on open-telemetry#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

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Amends the fix to open-telemetry#31627 (following a comment I made on open-telemetry#35932)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

The documentation that was added for the `uptime` scraper was renamed
accordingly, and the description adjusted.

<!--Please delete paragraphs that you did not use before submitting.-->
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…-telemetry#36123)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes some changes that I had hoped to suggest on open-telemetry#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

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Amends the fix to open-telemetry#31627 (following a comment I made on open-telemetry#35932)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

The documentation that was added for the `uptime` scraper was renamed
accordingly, and the description adjusted.

<!--Please delete paragraphs that you did not use before submitting.-->
dmitryax pushed a commit that referenced this pull request Feb 18, 2026
…ed to system (#46149)

#### Description

The hostmetricsreceiver `uptime` scraper was renamed to system awhile
ago, see #36123 . However, the sample config was never updated to match
this, if the users uses `uptime` in their config the collector will not
run as the `uptime` scraper is no longer present, this scraper has been
renamed to system.

#### Using uptime

##### Config

```yaml
extensions:
  zpages:
    endpoint: 0.0.0.0:55679

receivers:
  hostmetrics:
    collection_interval: 1m
    scrapers:
      ...
      uptime:

exporters:
  debug:
  prometheus:
    endpoint: 0.0.0.0:8889

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      exporters: [prometheus, debug]

  extensions: [zpages]
```

##### Output

```bash
opentelemetry-collector-contrib main  ✗ make run otelcontribcol
cd ./cmd/otelcontribcol && GO111MODULE=on go run --race . --config ../../local/config.yaml
Error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

'receivers' error reading configuration for "hostmetrics": '' invalid scraper key: uptime
exit status 1
make: *** [Makefile:359: run] Error 1
```

#### Fix

Use `system` instead of uptime, this is only an issue with the
[example-config.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/example_config.yaml?plain=1#L18)
for hostmetrics, this work just renames `uptime` to `system`.
geekdave pushed a commit to oso-team/opentelemetry-collector-contrib that referenced this pull request Feb 20, 2026
…ed to system (open-telemetry#46149)

#### Description

The hostmetricsreceiver `uptime` scraper was renamed to system awhile
ago, see open-telemetry#36123 . However, the sample config was never updated to match
this, if the users uses `uptime` in their config the collector will not
run as the `uptime` scraper is no longer present, this scraper has been
renamed to system.

#### Using uptime

##### Config

```yaml
extensions:
  zpages:
    endpoint: 0.0.0.0:55679

receivers:
  hostmetrics:
    collection_interval: 1m
    scrapers:
      ...
      uptime:

exporters:
  debug:
  prometheus:
    endpoint: 0.0.0.0:8889

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      exporters: [prometheus, debug]

  extensions: [zpages]
```

##### Output

```bash
opentelemetry-collector-contrib main  ✗ make run otelcontribcol
cd ./cmd/otelcontribcol && GO111MODULE=on go run --race . --config ../../local/config.yaml
Error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

'receivers' error reading configuration for "hostmetrics": '' invalid scraper key: uptime
exit status 1
make: *** [Makefile:359: run] Error 1
```

#### Fix

Use `system` instead of uptime, this is only an issue with the
[example-config.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/example_config.yaml?plain=1#L18)
for hostmetrics, this work just renames `uptime` to `system`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

receiver/hostmetrics Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants