Skip to content

Commit 3217833

Browse files
committed
rust: add the display example
Add a log parser, a mqtt client and a web server. Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
1 parent a25c93c commit 3217833

11 files changed

Lines changed: 3293 additions & 8 deletions

File tree

rust/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,31 @@ it requires an OTLP collector as mentioned in the telemetry example section.
404404
cargo run --example collector --features telemetry
405405
```
406406

407+
### display
408+
409+
Minimal viewer pipeline to parse logs or read live MQTT into a SQLite DB and display tiles on a map.
410+
411+
Parse historical logs (handles .log, .log.gz, .tar.gz); it takes three positional
412+
arguments: the input directory, the quadkey zoom level and the output database path:
413+
414+
```shell
415+
cargo run --example display_log_reader -- /logs 18 /tmp/display.db
416+
```
417+
418+
Ingest from MQTT messages:
419+
420+
```shell
421+
cargo run --example display_mqtt_reader -- --config examples/config.ini
422+
```
423+
424+
Serve the map UI:
425+
426+
```shell
427+
cargo run --example display_server -- --config examples/config.ini
428+
```
429+
430+
Open the map at http://localhost:3000/ and zoom to display the message metrics.
431+
407432
[1]: https://github.com/Orange-OpenSource/its-client/actions/workflows/rust.yml
408433

409434
[2]: https://crates.io/crates/libits-client

rust/examples/config.ini

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#username = username
88
#password = password
99

10-
# mqtt settings
10+
# MQTT client
1111
[mqtt]
1212
# broker host to connect to
1313
host = test.mosquitto.org
@@ -19,6 +19,8 @@ use_tls = true
1919
use_websocket = false
2020
# client id to provide at the connection
2121
client_id = com_app_its-client-1
22+
# optional, path to a CA bundle (PEM). Default: system store
23+
#ca_path = /etc/ssl/certs/ca-certificates.crt
2224
# optional, connection timeout
2325
connection_timeout = 60
2426
# optional, ACL username
@@ -61,15 +63,14 @@ use_tls = false
6163
# optional, basic auth password
6264
#password = password
6365

64-
# collector example custom settings
65-
# See: Configuration:custom_settings
66-
# See: Configuration:get
66+
# receiver (subscription) settings
6767
[receiver]
6868
# optional, list of topic (with a comma ',' separator) to subscribe to, default to "#"
6969
#topic_list = "test/topic1","test/topic2"
7070
# optional, topic level number to put together into the router
7171
#route_level = 2
7272

73+
# collector example custom settings
7374
[exporter]
7475
# optional, true to export the received messages to the console, default to false
7576
#stdout = true
@@ -99,7 +100,14 @@ client_id = com_app_its-exporter-1
99100
#username = username
100101
# optional, ACL password
101102
#password = password
102-
# optional, list of topic level to update with its new value.
103-
# e.g. with "1=another/source","3=replaced":
104-
# "/my/specific/original/topic" => "another/source/specific/replaced/topic`
105-
topic_level_update_list = "1=collector"
103+
# optional, list of topic levels to rewrite
104+
#topic_level_update_list = "1=collector"
105+
106+
# display example custom settings
107+
[display]
108+
# path to the SQLite database
109+
db_path = examples/display.db
110+
# quadkey zoom (ingestor only)
111+
zoom = 18
112+
# web server port (server only)
113+
port = 3000

0 commit comments

Comments
 (0)