-
Notifications
You must be signed in to change notification settings - Fork 10
RD-4202 - prevent collection of lumigo events #166
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| _is_span_has_error, | ||
| create_step_function_span, | ||
| get_current_ms_time, | ||
| get_region, | ||
| ) | ||
| from lumigo_tracer import lumigo_utils | ||
| from lumigo_tracer.parsing_utils import parse_trace_id, safe_split_get, recursive_json_join | ||
|
|
@@ -115,10 +116,10 @@ def start(self, event=None, context=None): | |
| def handle_timeout(self, *args): | ||
| get_logger().info("The tracer reached the end of the timeout timer") | ||
| to_send = [s for s in self.spans if s["id"] in self.span_ids_to_send] | ||
| self.span_ids_to_send.clear() | ||
| if Configuration.send_only_if_error: | ||
| to_send.append(self._generate_start_span()) | ||
| lumigo_utils.report_json(region=self.region, msgs=to_send) | ||
| self.span_ids_to_send.clear() | ||
|
|
||
| def start_timeout_timer(self, context=None) -> None: | ||
| if Configuration.timeout_timer: | ||
|
|
@@ -158,7 +159,9 @@ def update_event_end_time(self) -> None: | |
| This function assumes synchronous execution - we update the last http event. | ||
| """ | ||
| if self.spans: | ||
| self.spans[-1]["ended"] = get_current_ms_time() | ||
| span = self.spans[-1] | ||
| span["ended"] = get_current_ms_time() | ||
| self.span_ids_to_send.add(span["id"]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we cleaned the |
||
|
|
||
| def update_event_times( | ||
| self, start_time: Optional[datetime] = None, end_time: Optional[datetime] = None | ||
|
|
@@ -290,7 +293,7 @@ def create_span(cls, event=None, context=None, force=False) -> "SpansContainer": | |
| started=get_current_ms_time(), | ||
| name=os.environ.get("AWS_LAMBDA_FUNCTION_NAME"), | ||
| runtime=os.environ.get("AWS_EXECUTION_ENV"), | ||
| region=os.environ.get("AWS_REGION"), | ||
| region=get_region(), | ||
| memory_allocated=os.environ.get("AWS_LAMBDA_FUNCTION_MEMORY_SIZE"), | ||
| log_stream_name=os.environ.get("AWS_LAMBDA_LOG_STREAM_NAME"), | ||
| log_group_name=os.environ.get("AWS_LAMBDA_LOG_GROUP_NAME"), | ||
|
|
||
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fixes the first bug: the last HTTP call looks infinite although it has finished.
It happens because this call finishes while we send the TO report. I.e. we clean the
self.span_ids_to_sendtoo late.