Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Host Metrics receiver to OTel mode #4950

Conversation

andrzej-stencel
Copy link
Contributor

What does this PR do?

This PR makes the Host Metrics receiver available to users running Elastic Agent in otel mode.

Why is it important?

This allows users to collect infrastructure metrics and is a prerequisite to support the infrastructure integration with OTel Collector.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

How to test this PR locally

  1. Build the agent locally (see docs)
  2. Unpack the .tar.gz archive in build/distributions
  3. Run the built binary with `build/distributions/elastic-agent-*/elastic-agent otel --config internal/pkg/otel/testdata/all-components.yml

Related issues

@andrzej-stencel andrzej-stencel added enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Jun 18, 2024
@andrzej-stencel andrzej-stencel requested a review from a team as a code owner June 18, 2024 14:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

mergify bot commented Jun 18, 2024

This pull request does not have a backport label. Could you fix it @andrzej-stencel? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@cmacknz
Copy link
Member

cmacknz commented Jun 18, 2024

The Windows startup errors are potentially due to significant delay added by the init() function in https://github.com/leoluk/perflib_exporter/blob/d0f3e166e8e144b7c5b02c55bbff65626c2077a3/perflib/perflib.go#L267.

Thanks to @leehinman for spotting this. I don't think there's anything you can do in Elastic Agent to get around this, this will have to be improved or removed upstream.

@andrzej-stencel
Copy link
Contributor Author

The Windows startup errors are potentially due to significant delay added by the init() function in https://github.com/leoluk/perflib_exporter/blob/d0f3e166e8e144b7c5b02c55bbff65626c2077a3/perflib/perflib.go#L267.

Thanks to @leehinman for spotting this. I don't think there's anything you can do in Elastic Agent to get around this, this will have to be improved or removed upstream.

The https://github.com/leoluk/perflib_exporter repository is archived and recommends to use https://pkg.go.dev/github.com/prometheus-community/windows_exporter/pkg/perflib. This library apparently does not have the issue anymore. 🎉 prometheus-community/windows_exporter@11218a9#diff-a32807247e4aca11d44d5fefeab725bd8666039036720b9bd13ee154b19a896bL35

Let's add a replacement in go.mod and see if that helps. Simultaneously, I will push this fix in the upstream.

Copy link
Contributor

mergify bot commented Jun 19, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b otel-add-host-metrics-receiver upstream/otel-add-host-metrics-receiver
git merge upstream/main
git push upstream otel-add-host-metrics-receiver

@ycombinator ycombinator added backport-v8.14.0 Automated backport with mergify and removed backport-skip labels Jun 20, 2024
@ycombinator ycombinator requested review from michalpristas and removed request for faec June 21, 2024 02:13
@andrzej-stencel
Copy link
Contributor Author

Superseded by #4908

@andrzej-stencel andrzej-stencel deleted the otel-add-host-metrics-receiver branch June 24, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.14.0 Automated backport with mergify enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make hostmetricsreceiver available in otel mode
4 participants