Skip to content

Commit 494f594

Browse files
committed
docs: instructions for new message types in readme
1 parent 53ec990 commit 494f594

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ dynamic_pubsub_metric = { read_type = "PubSub", key = "/user/dynamicmetrics/2",
3737

3838
The `dtype` parameter represents how to parse the information obtained from Redis.
3939

40+
### Adding a new message type
41+
42+
0. have `typify` installed as a binary (`cargo install cargo-typify`)
43+
1. Get the json schema from the pydantic model, eg ```python >>> print(json.dumps(DynamicMetricMessage.model_json_schema(), indent=2))``` and save it to the models directory
44+
2. Run `cargo typify -B -a PartialEq -o [output_file] [input_file]` on the json schema
45+
3. Add pub mod `[new module name]` to `./src/models/mod.rs`
46+
4. Modify the generated model to account for the fact that each object layer is wrapped in a bec codec
47+
5. Re-export frequently used types from `./src/models/mod.rs` with `pub use`
48+
49+
4050
### Deployment
4151

4252
To use the systemd service as-is, a config should be created at `/etc/bec_log_ingestor.toml`, following the example in `install/example_config.toml`. For SLS deployments this is managed in puppet already.

0 commit comments

Comments
 (0)