Abstract out OTLP http exporter logic#5160
Open
lorenzoronzani wants to merge 9 commits intoopen-telemetry:mainfrom
Open
Abstract out OTLP http exporter logic#5160lorenzoronzani wants to merge 9 commits intoopen-telemetry:mainfrom
lorenzoronzani wants to merge 9 commits intoopen-telemetry:mainfrom
Conversation
Author
|
/easycla |
2a75552 to
4405d3e
Compare
| client_cert: Optional[Union[str, Tuple[str, str]]], | ||
| timeout: float, | ||
| shutdown_event: threading.Event, | ||
| result: Any, |
Contributor
There was a problem hiding this comment.
is there a better Type for this param ?
| backoff_seconds = 2**retry_num * random.uniform(0.8, 1.2) | ||
| export_error: Optional[Exception] = None | ||
| try: | ||
| resp = _export( |
Contributor
There was a problem hiding this comment.
you could use the walrus operator here to shorten it a tiny bit...
if (resp := _export()).ok:
| _logger.warning("Shutdown in progress, aborting retry.") | ||
| break | ||
| return LogRecordExportResult.FAILURE | ||
| success = _export_with_retries( |
Contributor
There was a problem hiding this comment.
you could shorten it a bit by just returning inline here.. return LogRecordExport.success if _export.... else return ... There's also probably a way to pass LogRecordExportResult into the function and return it directly using typing.generics but I couldn't figure that out easily..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR contains the refactoring required inside the
http_exporter_logiccomponent. The idea is to remove the duplicated code abstracting out inside a common sectionFixes #2990
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
uv run tox -e py312-test-opentelemetry-exporter-otlp-proto-httpDoes This PR Require a Contrib Repo Change?
Checklist: