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

Rust sdk #153

Open
wants to merge 15 commits into
base: 2.0.0
Choose a base branch
from
Open

Rust sdk #153

wants to merge 15 commits into from

Conversation

nbuffon
Copy link
Member

@nbuffon nbuffon commented Sep 13, 2024

What's new

  • Add json_counter example to illustrate how to use mqtt mod
  • Use test.mosquitto.org as public MQTT broker in the example configuration file
  • Allow to add publish properties in MQTT messages

Closes #125

mobility

  • Fix geo_topic failing unit test
  • New feature mobility for mobility related structs and methods
  • Restrict mobility related structs and methods to mobility feature

telemetry

How to test

  1. Launch json_counter example

    cargo run --example json_counter
    

    Example runs and yields about the number of JSON messages received among the total

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

  2. Configure OTLP collector
    Edit the example/config.ini file to set the OTLP collector endpoint config by filling the following section

    [telemetry]
    host="otlp.domain.ext"
    port=4318
    ; Optionnal, defaults to "v1/traces"
    path="custom/v1/traces"
    
  3. Launch telemetry example

    cargo run --example telemetry --features telemetry
    

    Example runs and sends 4 traces

    Transport: standard MQTT; TLS disabled
    INFO [telemetry] logger ready on log
    INFO [telemetry] Send a trace with a single span 'ping' root span
    INFO [telemetry] └─ Ping                  trace_id: 4d9183d7274f4b8c850d46887f35141a, span_id: bd458664e66f860e
    DEBUG [reqwest::connect] starting new connection: http://90.84.47.115:18000/
    INFO [telemetry] Send a trace with a single span 'pong' root span linked with the previous one 'ping'
    INFO [telemetry] └─ Pong                  trace_id: 8479671f21bf9b0fd166b8ead1ff2761, span_id: 3c153c5e70a8a2a2
    INFO [telemetry] Send a single trace with two spans
    INFO [telemetry] └─ Root                  trace_id: cd4a1ee42952fcafc5eaf61f1881eca2, span_id: 7580f10ca1595e5b
    INFO [telemetry]    └─ Child              trace_id: cd4a1ee42952fcafc5eaf61f1881eca2, span_id: d570aff4e9889e95
    INFO [telemetry] Send a trace with 3 spans from 3 threads
    INFO [telemetry] └─ Main thread           trace_id: 6b1fe1d4b7aa574bbbe4b987053bcfd2, span_id: e5050064d17d0527
    INFO [telemetry]    ├─ Sender thread      trace_id: 6b1fe1d4b7aa574bbbe4b987053bcfd2, span_id: 9f449076f02efdd6
    INFO [telemetry]    └─ Listener thread    trace_id: 6b1fe1d4b7aa574bbbe4b987053bcfd2, span_id: d1bb7d93ec83207e
    
  4. Launch copycat example

    cargo run --example copycat --features geo_routing
    

    => The example correctly runs

@nbuffon nbuffon added bug Something isn't working enhancement New feature or request Rust Rust code labels Sep 13, 2024
@nbuffon nbuffon added this to the Sprint 2 milestone Sep 13, 2024
@nbuffon nbuffon self-assigned this Sep 13, 2024
@nbuffon nbuffon force-pushed the rust_sdk branch 6 times, most recently from 8cbfb17 to 86cf21a Compare September 16, 2024 09:35
@nbuffon nbuffon requested a review from tigroo September 16, 2024 12:52
@nbuffon nbuffon force-pushed the rust_sdk branch 7 times, most recently from d910227 to c4392f0 Compare September 20, 2024 08:11
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]>
@tigroo
Copy link
Collaborator

tigroo commented Sep 20, 2024

test 1 ok:

kvmk8371@yd-89lzhs3:~/Workspace/its-client/rust$ cargo run --example json_counter
   Compiling cfg-if v1.0.0
   ...
   Compiling libits-client v2.0.0 (/home/kvmk8371/Workspace/its-client/rust)
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 55.10s
     Running `target/debug/examples/json_counter`
Transport: standard MQTT; TLS disabled
Log is written to log/json_counter_rCURRENT.log
Received 1000 messages including 997 as JSON
Received 2000 messages including 1997 as JSON...
``

@tigroo
Copy link
Collaborator

tigroo commented Sep 20, 2024

I fail to receive the copycat. Please let's describe the exact test to process. My test:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ 

I don't receive the copy:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_sub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/# -v


default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 {"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}
default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 {"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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 log:

INFO [libits::client::application::pipeline] Starting MQTT publishing thread...
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we received an item as itself ora_car_4044 or stopped: we don't copy cat
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration

@tigroo
Copy link
Collaborator

tigroo commented Sep 20, 2024

I've got a curious log we I run the copycat:

INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration

@tigroo
Copy link
Collaborator

tigroo commented Sep 20, 2024

test 3 ko. Just reading the code, it seems the path config field isn't read, and we use http://its-platform.com:17910/v1/traces instead of (http://its-platform.com:17910/telemetry/default/v1/traces (not sure):

[telemetry]
host = its-platform.com
port = 17910
       Optional, defaults to 'v1/traces'
path = /telemetry/default/v1/traces
       Optional, defaults to 2048
max_batch_size = 10
kvmk8371@yd-89lzhs3:~/Workspace/its-client/rust$ cargo run --example telemetry --features telemetry
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.27s
     Running `target/debug/examples/telemetry`
Transport: standard MQTT; TLS disabled
INFO [telemetry] logger ready on log
INFO [telemetry] Send a trace with a single span 'ping' root span
INFO [telemetry] └─ Ping                  trace_id: 88854d97972fed61306f8b6613e0c83e, span_id: 5531a4273d67961a
INFO [telemetry] Send a trace with a single span 'pong' root span linked with the previous one 'ping'
INFO [telemetry] └─ Pong                  trace_id: 1161ea4e923a70c9e725e32a18a39e43, span_id: 5f20002b45dec110
INFO [telemetry] Send a single trace with two spans
INFO [telemetry] └─ Root                  trace_id: a735a8a6015546384c7a34ea9193de20, span_id: 7ea5299af9c17a4b
INFO [telemetry]    └─ Child              trace_id: a735a8a6015546384c7a34ea9193de20, span_id: 5ea8913ef6516a11
INFO [telemetry] Send a trace with 3 spans from 3 threads
INFO [telemetry] └─ Main thread           trace_id: 58d8ea775a0800e89527d82f7ea96ef7, span_id: 95e136ff7ff078df
INFO [telemetry]    ├─ Sender thread      trace_id: 58d8ea775a0800e89527d82f7ea96ef7, span_id: 596d6a1dd014423f
INFO [telemetry]    └─ Listener thread    trace_id: 58d8ea775a0800e89527d82f7ea96ef7, span_id: de902d4b1d6bafb4

Did you check on jaeger ?

Copy link
Collaborator

@tigroo tigroo left a comment

Choose a reason for hiding this comment

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

minor comments. tests 3 and 4 ko, to fix.

rust/README.md Show resolved Hide resolved
rust/examples/config.ini Outdated Show resolved Hide resolved
rust/src/client/application.rs Outdated Show resolved Hide resolved
rust/src/client/application.rs Show resolved Hide resolved
rust/src/client/configuration/mobility_configuration.rs Outdated Show resolved Hide resolved
rust/src/client/configuration/telemetry_configuration.rs Outdated Show resolved Hide resolved
rust/src/client/configuration/telemetry_configuration.rs Outdated Show resolved Hide resolved
rust/src/client/configuration/telemetry_configuration.rs Outdated Show resolved Hide resolved
@nbuffon
Copy link
Member Author

nbuffon commented Sep 23, 2024

I fail to receive the copycat. Please let's describe the exact test to process. My test:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ 

I don't receive the copy:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_sub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/# -v


default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 {"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}
default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 {"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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 log:

INFO [libits::client::application::pipeline] Starting MQTT publishing thread...
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we received an item as itself ora_car_4044 or stopped: we don't copy cat
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration

The example config connects to test.mosquitto.org there is no CAM sent there (or it would be some kind of a surprise) so there is nothing to copy
This example has not been modified at all, running it is just meant to test that using the geo_routing feature does correctly enables mobility which now includes all necessary functions and structs

If you want to test the behaviour of the the example you need to either connect to a broker where CAM are already sent or to send your own to test.mosquitto.org
But no line has changed in the example's source file

@nbuffon
Copy link
Member Author

nbuffon commented Sep 23, 2024

I've got a curious log we I run the copycat:

INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration

There is no Information message sent on test.mosquitto.org broker, the old monitor function thus does not have the information necessary to build the KPI log line

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]>
@tigroo
Copy link
Collaborator

tigroo commented Oct 1, 2024

I fail to receive the copycat. Please let's describe the exact test to process. My test:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ 

I don't receive the copy:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_sub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/# -v


default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 {"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}
default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 {"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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 log:

INFO [libits::client::application::pipeline] Starting MQTT publishing thread...
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we received an item as itself ora_car_4044 or stopped: we don't copy cat
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [copycat] we start to schedule 1077952580 from ora_car_4044
INFO [libits::client::application::pipeline] Cannot trace exchange, missing gateway component name in node configuration

The example config connects to test.mosquitto.org there is no CAM sent there (or it would be some kind of a surprise) so there is nothing to copy This example has not been modified at all, running it is just meant to test that using the geo_routing feature does correctly enables mobility which now includes all necessary functions and structs

If you want to test the behaviour of the the example you need to either connect to a broker where CAM are already sent or to send your own to test.mosquitto.org But no line has changed in the example's source file

I'm sending cam's : let's check the mosquitto_pub commands I shared just before the subscribtion.
I just try try to test the new mqtt client well works with the historical copycat example (whick worked previously I agree). Let's share into the PR description the exact commands to process to validate the test 4 (ie send message and validate it copies 3 second later).

@tigroo
Copy link
Collaborator

tigroo commented Oct 1, 2024

test 3 stays ko on my side. The config.ini file used:

[station]
id = "ora_opensource"
type = "mec_application"

[mqtt]
host = "test.mosquitto.org"
port = 1884
client_id = "com_orange_its-client"
username = "rw"
password = "readwrite"
use_tls = false
use_websocket = false

[node]
responsibility_enabled = true
thread_count = 4

[telemetry]
host = 90.84.47.115
port = 17910
       Optional, defaults to 'v1/traces'
path = /telemetry/default/v1/traces
       Optional, defaults to 2048
max_batch_size = 10

[log]
level = "debug"
folder = "log"

You could trace the complete url used to check if you're well using the config file.

@tigroo
Copy link
Collaborator

tigroo commented Oct 1, 2024

test 4 stays ko with my commands:

kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h 90.84.47.115 -p 11794 -u obu -P obu -i swr_tester_3 -t default/inQueue/v2x/denm/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type": "denm", "origin": "self", "version": "1.0.1", "source_uuid": "ora_car_testcon1", "timestamp": 1621602008340, "message": {"protocol_version": 2, "station_id": 16146508, "management_container": {"action_id": {"originating_station_id": 13101, "sequence_number": 13115}, "detection_time": 548686813340, "reference_time": 548686813340, "event_position": {"latitude": 435084065, "longitude": 12092271, "altitude": 20392}, "validity_duration": 10, "station_type": 5}, "situation_container": {"event_type": {"cause": 94, "subcause": 0}}, "location_container": {"event_speed": 0, "event_position_heading": 1585, "traces": []}}}'^C
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","timestamp":1618591359023,"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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ mosquitto_pub -h test.mosquitto.org -p 1884 -u rw -P readwrite -t default/outQueue/v2x/cam/ora_car_testcon1/1/2/0/2/2/2/0/2/3/1/0/3/1/1/2/1/0/0/0 -m '{"type":"cam","origin":"self","version":"1.2.0","source_uuid":"ora_car_4044","timestamp":1618591359123,"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}]}}}'
kvmk8371@yd-89lzhs3:~/Workspace/its-client$ 

Copy link
Collaborator

@tigroo tigroo left a comment

Choose a reason for hiding this comment

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

tests 3. and 4. ko on my side

@@ -0,0 +1,39 @@
/*
* Software Name : libits
Copy link
Collaborator

Choose a reason for hiding this comment

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

not fixed, pending

@tigroo
Copy link
Collaborator

tigroo commented Oct 1, 2024

test 4. ok :

[node]
responsibility_enabled = true
thread_count = 1

because each analyse is waiting a new message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request Rust Rust code
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants