-
Notifications
You must be signed in to change notification settings - Fork 377
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
DI progress logs #4283
base: master
Are you sure you want to change the base?
DI progress logs #4283
Changes from all commits
e4a951f
579023a
2ca5385
29c7c7b
80f90dc
f5e703f
f247eb6
90fdba5
607ad2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ module DI | |
# The loop inside the worker rescues all exceptions to prevent termination | ||
# due to unhandled exceptions raised by any downstream code. | ||
# This includes communication and protocol errors when sending the | ||
# payloads to the agent. | ||
# events to the agent. | ||
# | ||
# The worker groups the data to send into batches. The goal is to perform | ||
# no more than one network operation per event type per second. | ||
|
@@ -45,6 +45,7 @@ def initialize(settings, transport, logger, telemetry: nil) | |
|
||
def start | ||
return if @thread | ||
logger.debug("di: starting probe notifier: pid #{$$}") | ||
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. ⚪ Code Quality ViolationAvoid using cryptic PERL names. Consider importing English and using $PROCESS_ID instead. (...read more)The rule 'Avoid using Perl-style special variables' is important for improving the readability and maintainability of your code. Perl-style special variables, such as To avoid violating this rule, you can use the more descriptive aliases provided by the Here's a compliant code example: Instead of require 'English'
puts $LAST_READ_LINE
puts $ERROR_INFO This practice significantly enhances the readability of your code and makes it more accessible to developers who are not familiar with Perl-style variables. |
||
@thread = Thread.new do | ||
loop do | ||
# TODO If stop is requested, we stop immediately without | ||
|
@@ -94,6 +95,7 @@ def start | |
# to killing the thread using Thread#kill. | ||
def stop(timeout = 1) | ||
@stop_requested = true | ||
logger.debug("di: stopping probe notifier: pid #{$$}") | ||
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. ⚪ Code Quality ViolationAvoid using cryptic PERL names. Consider importing English and using $PROCESS_ID instead. (...read more)The rule 'Avoid using Perl-style special variables' is important for improving the readability and maintainability of your code. Perl-style special variables, such as To avoid violating this rule, you can use the more descriptive aliases provided by the Here's a compliant code example: Instead of require 'English'
puts $LAST_READ_LINE
puts $ERROR_INFO This practice significantly enhances the readability of your code and makes it more accessible to developers who are not familiar with Perl-style variables. |
||
wake.signal | ||
if thread | ||
unless thread.join(timeout) | ||
|
@@ -234,6 +236,7 @@ def set_sleep_remaining | |
end | ||
if batch.any? # steep:ignore | ||
begin | ||
logger.debug { "di: sending #{batch.length} #{event_type} event(s) to agent" } | ||
transport.public_send("send_#{event_type}", batch) | ||
time = Core::Utils::Time.get_time | ||
@lock.synchronize do | ||
|
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.
⚪ Code Quality Violation
Consider using a $stderr (...read more)
The rule "Avoid standard constants" is important in Ruby development as it encourages the use of global variables over standard constants. In Ruby, standard constants like
STDOUT
andSTDERR
are not as flexible as their global counterparts$stdout
and$stderr
.The main reason for avoiding standard constants is that they are not interchangeable in the same way that global variables are. This means they are less suited to situations where you might need to redirect output or error streams. For instance, in testing scenarios, you might want to redirect
$stdout
or$stderr
to a different output stream.Fortunately, Ruby provides an easy way to avoid this issue. Instead of using standard constants, you should use global variables. For example, replace
STDOUT
with$stdout
andSTDERR
with$stderr
. This allows for greater flexibility in your code and makes it more adaptable to different situations.