vlcrs-core: add support for tracer API
- Jan 30, 2025
-
-
Alexandre Janniaux authored
The tracer is designed to send the metrics towards a telegraf server using this kind of configuration: [[inputs.socket_listener]] service_address = "tcp://localhost:8094" The telegraf server can then forward the metrics towards an influxdb server for monitoring or directly to grafana live server[^1] for introspection. The influxdb database can also be used to query the metrics after they've been indexed. The application using the tracer can use the VLC_TELEGRAF_ENDPOINT environment variable (eg. VLC_TELEGRAF_ENDPOINT=tcp://127.0.0.1:8094) to set where the tracer will output the traces to. A bunch of notes and improvement left for later: - Unsafe code is still used for accessing the fields data since an union is used and union access is unsafe. It could probably be wrapped from the binding implementation. - There is no way to specify the address using the configuration since vlc_variable is not bound to the Rust bindings and no unsafe extern "C" code is done from the plugin. - The tracer currently panic as the telegraf server dies because it doesn't handle reconnection. Proper reconnection logic with maybe size-limited temporary storing might be a proper workaround for that. - The tracer doesn't use the timestamp provided by VLC right now, proper time conversion is required for it to work. - There's no proper tags for the metrics being sent, which is an issue given that tags are providing indexing on the data. The tags should be generated from the string values of the tracer. Maybe an additional "Role" should be added in the trace entry for that purpose. [^1]: https://grafana.com/blog/2021/08/16/streaming-real-time-telegraf-metrics-using-grafana-live/
e8e46b0d -
Alexandre Janniaux authored
This commit allows rust code to use the tracer API, through the trace!() macro, and also exposes a TracerCapability and TracerModuleLoader to create new tracer modules in Rust.
3a3b5d67
-