1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! # buswatch-types
//!
//! Core types for message bus observability. This crate defines the universal
//! schema that any message bus system can use to emit metrics consumable by
//! buswatch and other monitoring tools.
//!
//! ## Design Goals
//!
//! - **Zero required dependencies**: Core types work without any serialization framework
//! - **Optional serialization**: Enable `serde` and/or `minicbor` features as needed
//! - **Protocol agnostic**: Works with RabbitMQ, Kafka, NATS, Redis Streams, or custom buses
//! - **Versioned schema**: Snapshots include version info for forward compatibility
//! - **Ergonomic builders**: Fluent API for constructing snapshots
//!
//! ## Features
//!
//! - `std` (default): Standard library support
//! - `serde`: JSON/MessagePack/etc. serialization via serde
//! - `minicbor`: Compact binary serialization via CBOR
//! - `all`: Enable all serialization formats
//!
//! ## Example
//!
//! ```rust
//! use buswatch_types::{Snapshot, ModuleMetrics, ReadMetrics, WriteMetrics};
//! use std::time::Duration;
//!
//! // Build a snapshot using the builder pattern
//! let snapshot = Snapshot::builder()
//! .module("order-processor", |m| {
//! m.read("orders.new", |r| {
//! r.count(1500)
//! .backlog(23)
//! .pending(Duration::from_millis(150))
//! })
//! .write("orders.processed", |w| {
//! w.count(1497)
//! })
//! })
//! .module("notification-sender", |m| {
//! m.read("orders.processed", |r| r.count(1450).backlog(47))
//! })
//! .build();
//!
//! assert_eq!(snapshot.modules.len(), 2);
//! ```
//!
//! ## Schema Version
//!
//! The current schema version is **1**. The version is included in serialized
//! snapshots to allow consumers to handle format evolution gracefully.
extern crate alloc;
pub use *;
pub use *;
pub use *;
pub use *;
/// Current schema version.
///
/// Increment this when making breaking changes to the snapshot format.
/// Consumers should check this version and handle older formats appropriately.
pub const SCHEMA_VERSION: u32 = 1;