detritus_protocol/lib.rs
1//! Wire protocol types for Detritus telemetry and crash ingestion.
2//!
3//! `detritus-protocol` owns the schema shared by `detritus-client` and
4//! `detritus-server`: source identity, crash envelopes, and the curated OTLP
5//! log facade used by the client and receiver. Version `0.1.0` supports OTLP
6//! logs only; traces and metrics are intentionally outside the published
7//! compatibility surface.
8//!
9//! [`PROTOCOL_VERSION`] is carried in HTTP and gRPC metadata so clients and
10//! servers can reject payloads encoded for an incompatible schema.
11//!
12//! ```
13//! use detritus_protocol::PROTOCOL_VERSION;
14//!
15//! assert_eq!(PROTOCOL_VERSION, 1);
16//! ```
17
18/// Crash-report schema types and protocol errors.
19pub mod crash;
20#[cfg(feature = "multipart")]
21/// Multipart encoding and parsing helpers for crash envelopes.
22pub mod multipart;
23/// Curated OpenTelemetry Protocol log-service bindings.
24pub mod otlp;
25/// Per-tenant JSON Schema descriptors for payload validation.
26pub mod schema;
27/// Source identity attached to Detritus payloads.
28pub mod source;
29
30/// Crash-report schema types re-exported for the common import path.
31pub use crash::{
32 AttachmentManifest, BuildInfo, CrashAttachment, CrashEnvelope, CrashKind, CrashMetadata,
33 ProtocolError,
34};
35/// Source identity re-exported for the common import path.
36pub use source::SourceId;
37
38/// Current observability ingestion schema version.
39pub const PROTOCOL_VERSION: u32 = 1;
40/// gRPC metadata key carrying [`PROTOCOL_VERSION`].
41pub const GRPC_VERSION_KEY: &str = "x-protocol-version";
42/// HTTP header carrying [`PROTOCOL_VERSION`].
43pub const HTTP_VERSION_HEADER: &str = "X-Protocol-Version";