Skip to content

Resourcedetection fails on hostnames with period (".") #2148

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

Closed
alexvanboxel opened this issue Jan 20, 2021 · 3 comments
Closed

Resourcedetection fails on hostnames with period (".") #2148

alexvanboxel opened this issue Jan 20, 2021 · 3 comments
Assignees
Labels
bug Something isn't working priority:p2 Medium release:allowed-for-ga

Comments

@alexvanboxel
Copy link
Contributor

Describe the bug
Resourcedetection fails to start pipeline on a system with hostnames with period (".") with failed getting FQDN. Yes it's allowed: Host names may contain only alphanumeric characters, minus signs ("-"), and periods (".")( from:
https://man7.org/linux/man-pages/man5/hosts.5.html )

Steps to reproduce
Set the hostname of a system to something that includes a ..
Add a processor to the config:

processors:
  batch:
  resourcedetection:
    detectors: [ "system" ]

Start the collector

What did you expect to see?
A pipeline that starts and add the host resource

What did you see instead?

Error: cannot setup pipelines: cannot start processors: failed getting FQDN: fqdn hostname not found: lookup alex.vanboxel-MBP: no such host
2021/01/20 11:49:09 application run finished with error: cannot setup pipelines: cannot start processors: failed getting FQDN: fqdn hostname not found: lookup alex.vanboxel-MBP: no such host

What version did you use?
Version: 0.18.0

What config did you use?

processors:
  batch:
  resourcedetection:
    detectors: [ "system" ]

Environment
MacOS X Catalina 10.15.7

Additional context
Add any other context about the problem here.

@alexvanboxel alexvanboxel added the bug Something isn't working label Jan 20, 2021
@mx-psi
Copy link
Member

mx-psi commented Jan 20, 2021

It might be a different thing but I suspect this is related to this known issue: https://github.com/Showmax/go-fqdn#known-issues from the package that we use for getting the FQDN. If it is indeed this issue, since the OpenTelemetry Collector does not allow for the use of cgo I think the only alternatives are either

  1. disabling the FQDN on macOS or
  2. finding an alternative package for getting the FQDN.

@alexvanboxel
Copy link
Contributor Author

Thanks, I didn't realize it was a Mac problem only. So with your remark, I stepped through the code and I found a workaround to make it not crash (adding the name to the hostnames file), not perfect but that's why it's called a workaround. I'll see that I can add it to the README.

dyladan referenced this issue in dynatrace-oss-contrib/opentelemetry-collector-contrib Jan 29, 2021
Next steps will be to use the new settings in the processors.

Signed-off-by: Bogdan Drutu <[email protected]>
@jrcamp
Copy link
Contributor

jrcamp commented Jun 30, 2021

We fallback to using the plain hostname if fqdn lookup fails as of #3099. Closing since it's not a fatal error now and we rely on go-fqdn to do the fqdn magic.

@jrcamp jrcamp closed this as completed Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:p2 Medium release:allowed-for-ga
Projects
None yet
Development

No branches or pull requests

4 participants