Skip to main content

sample_config_from_json

Function sample_config_from_json 

Source
pub(crate) fn sample_config_from_json(
    bytes: &[u8],
) -> Result<SampleConfig, LJMError>
Expand description

Parses a NATS KV JSON value into a runtime sampling config.

This is the deserialization boundary for streamer configuration. It accepts the dashboard’s nested schema (NestedConfig) and reports JSON errors as LJMError values so the rest of the streamer can use one error type. No checks beyond deserialization are done (for example, an empty channel list is accepted).

§Arguments

  • bytes - Raw KV value, UTF-8 JSON.

§Errors

Returns LJMError::LibraryError if the bytes are not valid JSON, a required field is missing, or a field has the wrong type.