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

inject_tlm performed by microservices #614

Merged
merged 6 commits into from
Apr 16, 2023
Merged

inject_tlm performed by microservices #614

merged 6 commits into from
Apr 16, 2023

Conversation

ryanmelt
Copy link
Member

also repair interface_cmd, protocol_cmd, and router commanding
closes #518

@ryanmelt ryanmelt requested a review from jmthomas April 15, 2023 19:55
@codecov
Copy link

codecov bot commented Apr 15, 2023

Codecov Report

Patch coverage: 87.59% and project coverage change: +0.27 🎉

Comparison is base (637647b) 74.48% compared to head (3b7baaa) 74.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #614      +/-   ##
==========================================
+ Coverage   74.48%   74.75%   +0.27%     
==========================================
  Files         457      458       +1     
  Lines       28270    28359      +89     
  Branches      588      588              
==========================================
+ Hits        21056    21200     +144     
+ Misses       7121     7066      -55     
  Partials       93       93              
Flag Coverage Δ
frontend 75.10% <ø> (-0.05%) ⬇️
ruby-api 51.02% <ø> (ø)
ruby-backend 79.05% <87.59%> (+0.38%) ⬆️

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

Impacted Files Coverage Δ
...c3/lib/openc3/microservices/router_microservice.rb 56.75% <50.00%> (+23.42%) ⬆️
openc3/lib/openc3/topics/router_topic.rb 92.45% <75.00%> (+26.41%) ⬆️
...lib/openc3/microservices/interface_microservice.rb 82.83% <81.81%> (+5.00%) ⬆️
openc3/lib/openc3/api/tlm_api.rb 99.00% <100.00%> (-0.01%) ⬇️
...nc3/lib/openc3/conversions/unix_time_conversion.rb 82.60% <100.00%> (+1.65%) ⬆️
openc3/lib/openc3/interfaces/interface.rb 96.26% <100.00%> (+5.06%) ⬆️
...nc3/lib/openc3/microservices/decom_microservice.rb 87.01% <100.00%> (+1.50%) ⬆️
...lib/openc3/microservices/interface_decom_common.rb 100.00% <100.00%> (ø)
openc3/lib/openc3/packets/commands.rb 97.31% <100.00%> (+0.03%) ⬆️
openc3/lib/openc3/packets/packet_config.rb 97.76% <100.00%> (ø)
... and 3 more

... and 3 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.

else
packet.received_count = 1
DecomTopic.inject_tlm(target_name, packet_name, item_hash, type: type, scope: scope)
Copy link
Member

Choose a reason for hiding this comment

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

Most targets have interfaces but if not we use Decom which is always deployed for each packet. What does the use of the Interface get you over Decom?

Copy link
Member Author

Choose a reason for hiding this comment

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

Its a matter of who is keeping track of received_count

read_index += 1
write_index += 1
end
end
Copy link
Member

Choose a reason for hiding this comment

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

So the bug was not building up the list according to their type. Previously it would have gone through all whether they were :READ or :WRITE.

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 real bug was not command WRITE protocols if READ_WRITE was specified. READ_WRITE is suppose to be effectively all for protocols

decom_packet(topic, msg_id, msg_hash, redis)
if topic =~ /__DECOMINTERFACE/
if msg_hash.key?('inject_tlm')
handle_inject_tlm(msg_hash['inject_tlm'])
Copy link
Member

Choose a reason for hiding this comment

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

Seems like __DECOMINTERFACE__ is a dedicated topic for inject_tlm. Is there a reason to check the msg_hash for inject_tlm? Is this going to be used for something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just inject_tlm for now. Might be other things in the future.

@@ -164,7 +171,7 @@ def run
if target_name
command = System.commands.identify(cmd_buffer, [target_name])
else
command = System.commands.identify(cmd_buffer, @cmd_target_names)
command = System.commands.identify(cmd_buffer, @interface.cmd_target_names)
Copy link
Member

Choose a reason for hiding this comment

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

This is just a straight up bug. How have we never hit this before? And therefore is it even necessary?

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 code is needed if not using the PREIDENTIFIED interface

packet = identified_packet if identified_packet
end

begin
RouterTopic.route_command(packet, @cmd_target_names, scope: @scope)
RouterTopic.route_command(packet, @interface.cmd_target_names, scope: @scope)
Copy link
Member

Choose a reason for hiding this comment

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

So this was just getting rescued and logging errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep

RouterStatusModel.set(@interface.as_json(:allow_nan => true), scope: @scope)
if !packet.identified?
# Need to identify so we can find the target
identified_packet = System.commands.identify(packet.buffer(false), @cmd_target_names)
identified_packet = System.commands.identify(packet.buffer(false), @interface.cmd_target_names)
Copy link
Member

Choose a reason for hiding this comment

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

I guess all packets are identified because otherwise this would have crashed the router.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, when we are using the PREIDENTIFIED protocol

require 'openc3/topics/topic'

module OpenC3
class DecomTopic < Topic
Copy link
Member

Choose a reason for hiding this comment

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

We have CommandDecomTopic and TelemetryDecomTopic ... should this be InterfaceDecomTopic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I should just put this in TelemetryDecomTopic

@ryanmelt ryanmelt changed the title inject_tlm performed by threads. inject_tlm performed by microservices Apr 15, 2023
@ryanmelt ryanmelt merged commit 77edd22 into main Apr 16, 2023
@ryanmelt ryanmelt deleted the diff_plugin branch April 16, 2023 16:22
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.

inject_tlm invalidated due to not providing packet_time
2 participants