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

Python workflows are failing since PR #143 was merge in master; only the rust project is modified in this PR

  • 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
    

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]>
@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 2 times, most recently from c224e27 to b8ad4ef Compare September 13, 2024 16:11
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]>
@nbuffon nbuffon force-pushed the rust_sdk branch 4 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 6 times, most recently from 77a5677 to d910227 Compare September 19, 2024 13:44
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]>
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: Ready
Development

Successfully merging this pull request may close these issues.

1 participant