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

2.0.0 #119

Merged
merged 100 commits into from
Oct 10, 2024
Merged

2.0.0 #119

merged 100 commits into from
Oct 10, 2024

Conversation

nbuffon
Copy link
Member

@nbuffon nbuffon commented Jun 4, 2024

What's new

Rust

How to test

  1. Check workflow status
    => None must have failed

  2. Test MQTT example

    cargo run --example json_counter
    

    => The example must run successfully and log about message reception

    Received 1000 messages including 997 as JSON
    Received 2000 messages including 1997 as JSON
    Received 3000 messages including 2997 as JSON
    ...

  3. Test mobility example

    1. Edit the configuration to limit the analysis threads to 1

      [node]
      responsibility_enabled=true
      thread_count=1
    2. Launch the example

      cargo run --example copycat --features geo_routing
      

      => The example must run successfully

    3. Send a CAM message

      mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_1111","timestamp":1618591358923,"message":{"protocol_version":2,"station_id":1077952580,"generation_delta_time":31571,"basic_container":{"station_type":5,"reference_position":{"latitude":486230934,"longitude":22419064,"altitude":10000},"confidence":{"position_confidence_ellipse":{"semi_major_confidence":0,"semi_minor_confidence":0,"semi_major_orientation":0},"altitude":1}},"high_frequency_container":{"heading":2375,"speed":137,"drive_direction":0,"vehicle_length":47,"vehicle_width":24,"longitudinal_acceleration":1,"lateral_acceleration":0,"vertical_acceleration":0,"yaw_rate":-27,"lane_position":0,"curvature":0,"confidence":{"heading":2,"speed":3,"vehicle_length":1,"vehicle_width":1,"longitudinal_acceleration":5,"yaw_rate":6,"lane_position":1,"curvature":7}},"low_frequency_container":{"vehicle_role":0,"exterior_lights":"00000000","path_history":[{"path_position":{},"path_delta_time":1}]}}}'
      

      => The received CAM is scheduled for copy

      INFO [copycat] we start to schedule 1077952580 from ora_car_1111

    4. Wait a few seconds (more than 3)

    5. Send a second CAM

      mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_2222","timestamp":1618591358923,"message":{"protocol_version":2,"station_id":1077952580,"generation_delta_time":31571,"basic_container":{"station_type":5,"reference_position":{"latitude":486230934,"longitude":22419064,"altitude":10000},"confidence":{"position_confidence_ellipse":{"semi_major_confidence":0,"semi_minor_confidence":0,"semi_major_orientation":0},"altitude":1}},"high_frequency_container":{"heading":2375,"speed":137,"drive_direction":0,"vehicle_length":47,"vehicle_width":24,"longitudinal_acceleration":1,"lateral_acceleration":0,"vertical_acceleration":0,"yaw_rate":-27,"lane_position":0,"curvature":0,"confidence":{"heading":2,"speed":3,"vehicle_length":1,"vehicle_width":1,"longitudinal_acceleration":5,"yaw_rate":6,"lane_position":1,"curvature":7}},"low_frequency_container":{"vehicle_role":0,"exterior_lights":"00000000","path_history":[{"path_position":{},"path_delta_time":1}]}}}'
      

      => Second CAM is scheduled for copy

      INFO [copycat] we start to schedule 1077952580 from ora_car_2222

      => Previous received CAM is sent on inQueue

      INFO [copycat] we treat the scheduled item 1 1077952580 from ora_car_1111
      ...
      DEBUG [rumqttc::v5::state] Publish. Topic = default/inQueue/v2x/cam/com_orange_its-client_10000/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1, Pkid = 2, Payload Size = 962

  4. Test telemetry example

    1. Start an OTLP collector / Jager container
      docker run --rm --name jaeger \
        -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
        -p 6831:6831/udp \
        -p 6832:6832/udp \
        -p 5778:5778 \
        -p 16686:16686 \
        -p 4317:4317 \
        -p 4318:4318 \
        -p 14250:14250 \
        -p 14268:14268 \
        -p 14269:14269 \
        -p 9411:9411 -d\
        jaegertracing/all-in-one:1.58
      
    2. Edit the example/config.ini file to uncomment and fill the [telemetry] section to fit your OTLP collector configuration
      [telemetry]
      host=localhost
      port=4318
    3. Launch the example
      cargo run --example telemetry --features telemetry
      
      => Example must correctly run and send several traces
      INFO [telemetry] Send a trace with a single span 'ping' root span
      INFO [telemetry] └─ Ping                  trace_id: 73b0fc6aaabcf9d813ba811ec0e6f4e9, span_id: 80d0f05d323e21dc
      INFO [telemetry] Send a trace with a single span 'pong' root span linked with the previous one 'ping'
      INFO [telemetry] └─ Pong                  trace_id: 63b0e226166e81abb7e45d7b091ab437, span_id: b6579019050f097a
      INFO [telemetry] Send a single trace with two spans
      INFO [telemetry] └─ Root                  trace_id: 05f21e2ac259df6971a8f2f02f82d048, span_id: 640ead7c47fa77b2
      INFO [telemetry]    └─ Child              trace_id: 05f21e2ac259df6971a8f2f02f82d048, span_id: 155b1c980c506de4
      INFO [telemetry] Send a trace with 3 spans from 3 threads
      INFO [telemetry] └─ Main thread           trace_id: fe214e7d590290f88de05a0eb116dd6d, span_id: 21ebad2f7da3d157
      INFO [telemetry]    ├─ Sender thread      trace_id: fe214e7d590290f88de05a0eb116dd6d, span_id: 2fafb0feacea9e5a
      INFO [telemetry]    └─ Listener thread    trace_id: fe214e7d590290f88de05a0eb116dd6d, span_id:         1cf75b31cc5c0e70
      
    4. Check the Jaeger on localhost (http://localhost:16686/)
      => You must see the corresponding traces that the example logged about

@nbuffon nbuffon self-assigned this Jun 4, 2024
@tigroo
Copy link
Collaborator

tigroo commented Sep 9, 2024

@nbuffon , how to finalize these works? I review? We close without merging?

@nbuffon nbuffon changed the title Draft: 2.0.0 2.0.0 Oct 8, 2024
@nbuffon nbuffon added the Rust Rust code label Oct 9, 2024
@ymorin-orange
Copy link
Member

  1. No workflow in error
  2. json_counter example works
    • There are build warnings:
      warning: associated function `new` is never used
        --> src/transport/mqtt/mqtt_router.rs:33:19
         |
      32 | impl MqttRouter {
         | --------------- associated function in this implementation
      33 |     pub(crate) fn new() -> MqttRouter {
         |                   ^^^
         |
         = note: `#[warn(dead_code)]` on by default
      
      warning: `libits-client` (lib) generated 1 warning
          Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
           Running `target/debug/examples/json_counter`
      
  3. copycat example works
    • There are build warnings:
      warning: function `acceleration_to_etsi` is never used
        --> src/exchange/etsi.rs:83:15
         |
      83 | pub(crate) fn acceleration_to_etsi(m_per_s_2: f64) -> i16 {
         |               ^^^^^^^^^^^^^^^^^^^^
         |
         = note: `#[warn(dead_code)]` on by default
      
      warning: function `timestamp_from_etsi` is never used
        --> src/exchange/etsi.rs:87:15
         |
      87 | pub(crate) fn timestamp_from_etsi(etsi_timestamp: u64) -> u64 {
         |               ^^^^^^^^^^^^^^^^^^^
      
      warning: `libits-client` (lib) generated 2 warnings
          Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.71s
           Running `target/debug/examples/copycat`
      
  4. telemetry example works
    • There are build warnings:
      warning: associated function `new` is never used
        --> src/transport/mqtt/mqtt_router.rs:33:19
         |
      32 | impl MqttRouter {
         | --------------- associated function in this implementation
      33 |     pub(crate) fn new() -> MqttRouter {
         |                   ^^^
         |
         = note: `#[warn(dead_code)]` on by default
      
      warning: `libits-client` (lib) generated 1 warning
          Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s
           Running `target/debug/examples/telemetry`
      

Signed-off-by: Nicolas Buffon <[email protected]>
Using [Criterion][1] to add benchmarks in `benches` folder

Note that `benches` folder need to be copied in the build Docker image
otherwise the build fails

[1]: https://github.com/bheisler/criterion.rs

Signed-off-by: Nicolas Buffon <[email protected]>

Signed-off-by: Nicolas Buffon <[email protected]>
Renamed GeoExtension into Quadkey because it is what it is
Move the whole thing into mobility mod as quadtree is a positioning
solution

Signed-off-by: Nicolas Buffon <[email protected]>
Using the name Quadtree, despite not being a real implementation of it, to
match the mod and because we don't need a specific implementation of it
yet or any parsing performance specificaly

This could anyway be a good thing to bring a real tree implementation in
the future

Signed-off-by: Nicolas Buffon <[email protected]>
Signed-off-by: Nicolas Buffon <[email protected]>
This function returns the current timestamp in milliseconds

Signed-off-by: Nicolas Buffon <[email protected]>
Signed-off-by: Nicolas Buffon <[email protected]>
Most part of the code has been commented in exchange.rs because it uses
structs that will be moved or implemented in further commits

Signed-off-by: Nicolas Buffon <[email protected]>
Signed-off-by: Nicolas Buffon <[email protected]>
Signed-off-by: Nicolas Buffon <[email protected]>
This module describes the ETSI messages which are intended to be
exchanged
It also provides the functions to converts data from SI units to ETSI
fancy ones

Signed-off-by: Nicolas Buffon <[email protected]>
Signed-off-by: Nicolas Buffon <[email protected]>
This declaration is unnecessary as Cargo will look for this path by
default using the `name` field
It was also creating a warning at build about `unused manifest key: example.0.src`

Signed-off-by: Nicolas Buffon <[email protected]>
Switch to MQTTv5 using the corresponding module from rumqttc crate

Signed-off-by: Nicolas Buffon <[email protected]>
Enabling the `websocket` feature ead to MqttOptions losing `Send` trait
impl which made it unmovable to Tokio tasks (both our Configuration
struct and rumqttc's EventLoop were impacted)
This has been fixed in 0.24 release

Signed-off-by: Nicolas Buffon <[email protected]>
geo_routing enables mobility

Signed-off-by: Nicolas Buffon <[email protected]>
MqttClient and MqttRouter visibility was limited to the crate as they
were not meant to be exposed initially
Now that we need to be able to do MQTT without mobiity features,
removing the crate visibility restriction

Signed-off-by: Nicolas Buffon <[email protected]>
New example illustrating how to connect to a broker and treat messages
without using the mobility feature

Signed-off-by: Nicolas Buffon <[email protected]>
Requiring HTTP related features from open telemetry dependencies
As we use HTTP also add `reqwest` and `http` dependencies

Signed-off-by: Nicolas Buffon <[email protected]>
Module to provide higher level OpenTelemetry span management functions

Signed-off-by: Nicolas Buffon <[email protected]>
Restrict telemetry module to telemetry feature

Signed-off-by: Nicolas Buffon <[email protected]>
Impl Injector and Extractor traits for Packet to allow it to be used by
TraceContextPropagator for W3C context storage/retrieval
Use PublishProperties to store W3C context as MQTT property

Signed-off-by: Nicolas Buffon <[email protected]>
Signed-off-by: Nicolas Buffon <[email protected]>
This unit test was failing since the beginning but waas missed because
only `cargo test` was launched and as geo_topic module is restricted to
`geo_routing` feature it requires `cargo test --feature geo_routing` to
be launched

Signed-off-by: Nicolas Buffon <[email protected]>
SimpleExporter sends Span once they end and does not seem to be
compatible from Tokio runtime
Switch to BatchedSpanProcessor using Tokio runtime to fix the runtime
errors when using mobility pipeline and to enhance performances

Signed-off-by: Nicolas Buffon <[email protected]>
@ymorin-orange
Copy link
Member

There is a conflict on THIRD-PARTY.md. Please rebase and resolve the conflict before pushing again.

Copy link
Member

@ymorin-orange ymorin-orange left a comment

Choose a reason for hiding this comment

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

There is a conflict on THIRD-PARTY.md. Please rebase and resolve the conflict before pushing again.

@nbuffon
Copy link
Member Author

nbuffon commented Oct 9, 2024

There is a conflict on THIRD-PARTY.md. Please rebase and resolve the conflict before pushing again.

Sure, I already did the rebase, I was waiting for a cue from your side to push it
I'll also fix the warnings, either by real fix or by FIXMEing using an issue reference

It is only used in the `mobility` feature and then
raises a warning at build when the feature is not enabled
Its content does no more than Default trait implementation, so replace
any existing use by `MqttRouter::default()`

Signed-off-by: Nicolas Buffon <[email protected]>
Two in-crate functions are unused yet because the high level function
that the library will provide are not implemented yet, see [Github issue][1]

[1]: #131

Signed-off-by: Nicolas Buffon <[email protected]>
@nbuffon nbuffon force-pushed the 2.0.0 branch 2 times, most recently from c8fef4b to 68b2b77 Compare October 9, 2024 15:10
There is no longer a single binary packed with the Rust crate
The whoe project architecture has been switched to a library with
examples
In the process the Dockerfile was modified and does not describe any
image that can be launched anymore

Simply remove that step from the workflow has it was checking the
correct start of such an image

Signed-off-by: Nicolas Buffon <[email protected]>
@nbuffon
Copy link
Member Author

nbuffon commented Oct 9, 2024

I added 3 new commits, that you can review, to fix the workflow issue, and the build warnings

Copy link
Member

@ymorin-orange ymorin-orange left a comment

Choose a reason for hiding this comment

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

  1. No workflow in error
  2. json_counter example works
  3. copycat example works
  4. telemetry example works

No more warning during build.

@nbuffon nbuffon merged commit e2e8e85 into master Oct 10, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Rust code
Projects
Status: Done
3 participants