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

LOG_STREAM instead of LOG_RAW #540

Merged
merged 10 commits into from
Mar 21, 2023
Merged

LOG_STREAM instead of LOG_RAW #540

merged 10 commits into from
Mar 21, 2023

Conversation

jmthomas
Copy link
Member

closes #519

@jmthomas jmthomas requested a review from ryanmelt March 11, 2023 18:13
@codecov
Copy link

codecov bot commented Mar 11, 2023

Codecov Report

Patch coverage: 86.84% and project coverage change: +0.07 🎉

Comparison is base (2b6ad43) 74.02% compared to head (62d3f5e) 74.09%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #540      +/-   ##
==========================================
+ Coverage   74.02%   74.09%   +0.07%     
==========================================
  Files         457      457              
  Lines       28303    28277      -26     
  Branches      585      585              
==========================================
+ Hits        20950    20953       +3     
+ Misses       7259     7232      -27     
+ Partials       94       92       -2     
Flag Coverage Δ
ruby-api 51.05% <ø> (ø)
ruby-backend 78.06% <86.84%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...enc3/lib/openc3/logs/buffered_packet_log_writer.rb 96.55% <ø> (ø)
openc3/lib/openc3/logs/packet_log_writer.rb 99.00% <ø> (ø)
...c3/lib/openc3/interfaces/tcpip_server_interface.rb 63.10% <21.42%> (ø)
openc3/lib/openc3/models/interface_model.rb 89.89% <71.42%> (-0.88%) ⬇️
openc3/lib/openc3/logs/stream_log_pair.rb 92.59% <92.59%> (ø)
openc3/lib/openc3/config/config_parser.rb 93.75% <100.00%> (+0.02%) ⬆️
openc3/lib/openc3/interfaces/interface.rb 91.16% <100.00%> (+0.40%) ⬆️
...ib/openc3/interfaces/simulated_target_interface.rb 15.85% <100.00%> (+0.19%) ⬆️
openc3/lib/openc3/logs/log_writer.rb 90.34% <100.00%> (+0.05%) ⬆️
openc3/lib/openc3/logs/stream_log.rb 100.00% <100.00%> (ø)
... and 9 more

... and 8 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

logging_enabled = false,
cycle_size = 2000000000
cycle_size = 2000000000 # TODO: Need to be able to change this
Copy link
Member Author

Choose a reason for hiding this comment

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

Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

We need to implement cycle_time

@@ -183,7 +184,7 @@ def as_json(*a)
'secret_options' => @secret_options,
'protocols' => @protocols,
'log' => @log,
'log_raw' => @log_raw,
'log_stream' => @log_stream,
Copy link
Member Author

Choose a reason for hiding this comment

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

It should be ok to change the json output of this right?

@@ -155,12 +153,14 @@ def close_file
if @file
begin
@file.close unless @file.closed?
File.chmod(0444, @file.path) # Make file read only
Logger.instance.info "Raw Log File Closed : #{@filename}"
remote_log_directory = "#{ENV['OPENC3_SCOPE']}/stream_logs/"
Copy link
Member Author

Choose a reason for hiding this comment

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

New top level stream_logs directory

@@ -252,9 +253,10 @@ def handle_config(parser, keyword, parameters)
parser.verify_num_parameters(0, 0, "#{keyword}")
@log = false

when 'LOG_RAW'
when 'LOG_STREAM', 'LOG_RAW'
# TODO: Take parameters for the raw log class? See bridge_config.rb
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 would allow us to change the size but requires specific knowledge of the class initialize parameters. I was thinking something more like the existing TLM_LOG_CYCLE_TIME and TLM_LOG_CYCLE_SIZE with TLM as STREAM.

Do we instantiate the RawLoggerPair right here like in bridge_config? There's no consistency between the two.

@@ -165,6 +165,7 @@ def build
klass = OpenC3.require_class(protocol[1])
interface_or_router.add_protocol(klass, protocol[2..-1], protocol[0].upcase.intern)
end
interface_or_router.start_raw_logging if @log_stream
Copy link
Member Author

Choose a reason for hiding this comment

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

Raw logging is currently broken except for the APIs manually starting it. This allows it to start with the LOG_RAW or LOG_STREAM flag. But maybe this should move to the keyword parsing like in bridge_config?

@@ -40,6 +40,11 @@ class LogWriter
# independently.
attr_reader :cycle_time

# @return cycle_size [Integer] The amount of data in bytes before creating
# a new log file. This can be combined with cycle_time but is better used
# independently.
Copy link
Member

@ryanmelt ryanmelt Mar 20, 2023

Choose a reason for hiding this comment

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

I don't think it is better used independenly. The ideal is both, time and size, whichever comes first.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy / paste. I'll change the other comments.

def initialize(
log_name,
log_type,
cycle_time = 600, # 5 minutes, matches time in target_model
Copy link
Member

Choose a reason for hiding this comment

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

Comment should say 10 minutes

required: true
description: Ruby filename or class name which implements the stream log. Default is StreamLog.
values: .*
- name: Log specific parameters
Copy link
Member

Choose a reason for hiding this comment

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

You should list these out specifically, because the class isn't configurable

@@ -82,7 +82,8 @@ VARIABLE reduced_log_retain_time 2592000
PROTOCOL WRITE MyRejectProtocol
MAP_TARGET <%= example_target_name %>
DONT_CONNECT
LOG_STREAM
# Override the default log time of 600
LOG_STREAM StreamLog 60
Copy link
Member

Choose a reason for hiding this comment

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

Hardcode StreamLog and remove from given parameters

@jmthomas jmthomas merged commit b5818f6 into main Mar 21, 2023
@jmthomas jmthomas deleted the log_stream branch March 21, 2023 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send raw log file to minio
2 participants