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

[exporter/otlp] Report runtime status #11366

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

Conversation

mwear
Copy link
Member

@mwear mwear commented Oct 4, 2024

Description

This PR adds runtime status reporting for the otlp and otlphttp exporters. It's an updated version of #8788 which was one of several approaches experimented with to add this functionality. This work was paused to allow the consumererror work to evolve, as it appeared as though there might be a way to uniformly apply the same logic to all exporters (via the exporterhelper), but that work has taken a different direction, and it looks like a uniform approach will not be possible.

This PR implements runtime status reporting as discussed in #9957. The choices for which statuses represent permanent errors are up for debate, but the key point is that a permanent error is an error discovered at runtime that will require user intervention to fix.

This implementation makes use of the finite state machine that underlies the status reporting system. The finite state machine will ensure that:

  • Only changes in status are reported. Repeat reports of the same status will no-op.
  • If a component transitions into a PermanentError all further status reports will no-op.

This means the exporter does not have to reason about current or previous statuses. It can report status based on its current view of the world and the status reporting system will handle the rest. Flapping between recoverable and ok is meant to be handled by watchers consuming status events. The healthcheckv2extension handles this by using a time based approach (e.g. recovery interval). Other watchers may choose to handle this situation differently.

For more information on status reporting, the state machine, etc see: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md

While all components report status during start and shutdown (via automation), this is the first component to report runtime status. This will allow the healthcheckv2extension to replace the currently non-functioning check_collector_pipeline capability of the original healthcheckextension and should serve as an example for other components that wish to report runtime status moving forward.

Link to tracking issue

Implements #9957 for the otlp and otlphttp exporters

Testing

units/manual

Documentation

code comments

@mwear mwear requested a review from a team as a code owner October 4, 2024 22:07
@mwear mwear requested a review from codeboten October 4, 2024 22:07
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.64%. Comparing base (f74890a) to head (2043eba).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11366      +/-   ##
==========================================
+ Coverage   91.61%   91.64%   +0.03%     
==========================================
  Files         443      443              
  Lines       23770    23828      +58     
==========================================
+ Hits        21776    21837      +61     
+ Misses       1620     1618       -2     
+ Partials      374      373       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@mwear mwear force-pushed the exp-status branch 3 times, most recently from 646d3dc to 84944b7 Compare October 4, 2024 22:45
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Before implementation, can we document somewhere (ideal in RFC) or in https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md when an exporter is consider permanent error? I feel like we have different understandings of this and I don't want you to make lots of code changes until we agree on the basic definition.

exporter/otlpexporter/otlp.go Outdated Show resolved Hide resolved
exporter/otlpexporter/otlp.go Outdated Show resolved Hide resolved
@mwear
Copy link
Member Author

mwear commented Oct 18, 2024

Before implementation, can we document somewhere (ideal in RFC) or in https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md when an exporter is consider permanent error?

I have these documented here: #9957. Is it ok to discuss on that issue, or would you prefer it to be an RFC?

@mwear
Copy link
Member Author

mwear commented Oct 18, 2024

If you're suggesting that the errors identified as Permanent in this PR (and #9957) are in many cases recoverable, we can identify all errors as recoverable and skip permanent for now.

@bogdandrutu
Copy link
Member

bogdandrutu commented Oct 18, 2024

I am not the biggest expert, but I feel at least some are recoverable, and some are contextual (example auth when passing auth tokens from the client).

If you're suggesting that the errors identified as Permanent in this PR (and #9957) are in many cases recoverable, we can identify all errors as recoverable and skip permanent for now.

I think would be safer correct?

@mwear
Copy link
Member Author

mwear commented Oct 18, 2024

I think going with recoverable for all errors, at least for now, makes sense. We can discuss what errors should be permanent on #9957, but I suspect we'll be able to come up with counter arguments for most of the cases.

@mwear mwear force-pushed the exp-status branch 2 times, most recently from ba773f0 to 66dbf98 Compare October 18, 2024 22:24
@mwear
Copy link
Member Author

mwear commented Oct 18, 2024

I updated this PR to handle all errors as recoverable. If we are happy with this approach, we could consider making this an option for all exporters via exporter helper similar to: #8684 likely as a followup.

exporter/otlpexporter/otlp.go Outdated Show resolved Hide resolved
componentstatus.ReportStatus(e.host, componentstatus.NewRecoverableErrorEvent(err))
return
}
componentstatus.ReportStatus(e.host, componentstatus.NewEvent(componentstatus.StatusOK))
Copy link
Member

Choose a reason for hiding this comment

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

Are we not concerned for every request to report the status? Should we do it periodically, or only when changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

The finite state machine handles this for us. It will report status only if there has been a change, otherwise it will no-op.

@mwear mwear force-pushed the exp-status branch 2 times, most recently from 94fd12c to 1a6e939 Compare October 24, 2024 00:15
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Nov 12, 2024
@mwear
Copy link
Member Author

mwear commented Nov 23, 2024

Would anyone be interested in reviewing this, or at least removing the stale label?

@github-actions github-actions bot removed the Stale label Nov 23, 2024
Copy link
Contributor

github-actions bot commented Dec 7, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Dec 7, 2024
@atoulme atoulme removed the Stale label Dec 11, 2024
componentstatus.ReportStatus(e.host, componentstatus.NewRecoverableErrorEvent(err))
return err
}
componentstatus.ReportStatus(e.host, componentstatus.NewEvent(componentstatus.StatusOK))
Copy link
Contributor

Choose a reason for hiding this comment

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

this might create a lot of events reporting OK, is that really what you want? Is it there to recover from the error status?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants