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 an otelcol.processor.resourcedetection component #5764

Merged
merged 16 commits into from
Jan 23, 2024

Conversation

ptodev
Copy link
Contributor

@ptodev ptodev commented Nov 14, 2023

This is a draft PR to port over the resource detection processor. There are a few things which we need to agree on before the PR is taken out of "draft" stage. I will open comments on the specific lines where we need consensus.

@ptodev ptodev linked an issue Nov 14, 2023 that may be closed by this pull request
Comment on lines 59 to 64
// HTTP client settings for the detector
// Timeout default is 5s
// Client otelcol.HTTPClientArguments `river:",squash"`
Timeout time.Duration `river:"timeout,attr,optional"`
//TODO: Uncomment this later? Can we just get away with a timeout, or do we need all the http client settings?
// It seems that HTTP client settings are only used in the ec2 detection via ClientFromContext.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The HTTP settings in the Collector expose HTTP client settings for two reasons:

  • The timeout is used to cancel resource detections if they take too long. This use case has nothing to do with HTTP at all.
  • The ec2 detection uses the HTTP settings if they are provided. This feature is not documented in the OTel docs.

For now I would like to expose just the timeout parameter:

  • This is because it would be super confusing to document timeout as both a timeout for HTTP and for ec2.
  • I'll leave a TODO to implement it in the future.

I wish the OTel Collector worked differently:

  • There should be a non-HTTP timeout settings for all detectors
  • There should be HTTP settings specific to the ec2 detector. That way ec2 won't use context, and it will be possible to have different HTTP settings for different detectors.

Maybe it'll be work raising these issues with the upstream maintainers.

Copy link
Contributor

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

@github-actions github-actions bot added the needs-attention An issue or PR has been sitting around and needs attention. label Dec 22, 2023
@ptodev ptodev force-pushed the 4183-otel-resource-detection-processor branch from 4e708de to 4bb42f6 Compare January 10, 2024 21:08
@ptodev ptodev removed the needs-attention An issue or PR has been sitting around and needs attention. label Jan 10, 2024
---------------------------------------------- | ------------------------------------------------- | --------
[resource_attributes](#ec2--resource_attributes) | Configures which resource attributes to add. | no

##### ec2 > resource_attributes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These ... > resource_attributes headings have a small weight of #### so that they don't appear in the ToC. This makes the ToC much cleaner.

@ptodev ptodev marked this pull request as ready for review January 10, 2024 21:16
@rlankfo
Copy link
Member

rlankfo commented Jan 10, 2024

Does this provide support for the env resource detector? e.g. setting resource attributes in OTEL_RESOURCE_ATTRIBUTES environment variable?

@ptodev ptodev force-pushed the 4183-otel-resource-detection-processor branch from 4d855af to 317b367 Compare January 11, 2024 14:08
@ptodev
Copy link
Contributor Author

ptodev commented Jan 11, 2024

Does this provide support for the env resource detector? e.g. setting resource attributes in OTEL_RESOURCE_ATTRIBUTES environment variable?

@rlankfo - Yes. It is mentioned in the docs and there is a unit test.

@ptodev ptodev force-pushed the 4183-otel-resource-detection-processor branch from ffefa15 to cf1f371 Compare January 18, 2024 12:26
Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

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

Some doc suggestions and questions

@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Jan 18, 2024
Copy link
Member

@tpaschalis tpaschalis left a comment

Choose a reason for hiding this comment

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

LGTM % some nits; I don't mean to block this PR as it's been a large effort, but I have a potential concern about the long-term maintainability of it and whether we could re-think how we configure these blocks and keep track of new options.

GIven that would be a big change in of itself, I'm fine with re-considering in a future PR.

Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

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

Docs look good to me

@ptodev ptodev force-pushed the 4183-otel-resource-detection-processor branch from 68d5af3 to 1a3f73f Compare January 23, 2024 11:41
@ptodev ptodev merged commit 74245fd into main Jan 23, 2024
10 checks passed
@ptodev ptodev deleted the 4183-otel-resource-detection-processor branch January 23, 2024 19:39
@mar4uk
Copy link
Contributor

mar4uk commented Jan 24, 2024

🎉

BarunKGP pushed a commit to BarunKGP/grafana-agent that referenced this pull request Feb 20, 2024
* Add a otelcol.processor.resourcedetection component

* PR review suggestions

* Make k8s API config authentication options const.

* Fail validation if an incorrect detector is supplied.

* Remove unnecessary Consul attributes.

---------

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. type/docs Docs Squad label across all Grafana Labs repos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OTEL: Resource Detection Processor
5 participants