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

[processor/resourcedetection] support for periodically do detect action #34959

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JaredTan95
Copy link
Member

Description: support for periodically do detect action

Link to tracking Issue: <#34876>

Testing:

Documentation:

@JaredTan95 JaredTan95 requested a review from a team September 2, 2024 13:53
@github-actions github-actions bot added the processor/resourcedetection Resource detection processor label Sep 2, 2024
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
defer intervalTicker.Stop()

var err error
for range intervalTicker.C {
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this loop exited?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an infinite loop that receives the timer's signal through the intervalTicker.C channel. Whenever the timer fires, the channel intervalTicker.C sends a time value.
Therefore, as long as the otel process does not exit, it will continue to execute periodically.
Do we need to add a flag so that users can configure when to exit?

rdp.resource, rdp.schemaURL, err = rdp.provider.Get(ctx, client)

if rdp.detectInterval > 0 {
go rdp.tickerDetect(ctx, client)
Copy link
Contributor

Choose a reason for hiding this comment

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

please make sure stop closes this coroutine to avoid leaks

component: resourcedetectionprocessor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: support for periodically do detect action.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
note: support for periodically do detect action.
note: add support to refreshing the resource provider performing detection.


var err error
for range intervalTicker.C {
rdp.resource, rdp.schemaURL, err = rdp.provider.Get(ctx, client)
Copy link
Contributor

Choose a reason for hiding this comment

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

is it safe to reassign without locks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/resourcedetection Resource detection processor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants