rtb-telemetry 0.7.4

Opt-in anonymous usage telemetry with pluggable sinks. Part of the phpboyscout Rust toolkit.
Documentation
---
title: Cargo features and requirements
description: What remote-sinks turns on, what ships by default, the MSRV, and the runtime and dependencies the crate needs.
---

# Cargo features and requirements

## Features

| Feature | Default | What it adds |
|---|---|---|
| `remote-sinks` | off | `HttpSink`, `HttpSinkConfig`, `OtlpSink`, `OtlpSinkConfig` |

`default = []` — there are no default features. A plain
`rtb-telemetry = "0.7"` gives you `NoopSink`, `MemorySink`, `FileSink`, the
consent module and the machine-ID derivation, and nothing that can reach
the network.

```toml
[dependencies]
rtb-telemetry = { version = "0.7", features = ["remote-sinks"] }
```

Turning `remote-sinks` on compiles in reqwest, url, secrecy, tonic and the
OpenTelemetry stack (`opentelemetry`, `opentelemetry_sdk`,
`opentelemetry-otlp`). That is a large dependency subtree to audit and to
build; leaving the feature off means none of it is compiled or linked at
all, not merely unused.

The `http_sink` and `otlp_sink` modules do not exist without the feature.
If `use rtb_telemetry::HttpSink` fails to resolve, the feature is off.

## Minimum supported Rust version

`rust-version = "1.82"`, edition 2021. Development in this repository pins
an exact toolchain (`rust-toolchain.toml`), but consumers only need 1.82 or
newer.

## What the crate needs at runtime

- **A Tokio runtime.** `emit` and `flush` are `async`, and `FileSink` uses
  Tokio's filesystem API. The crate depends on `tokio` with the `full`
  feature set, so it is already in your tree.
- **TLS via rustls.** `reqwest` is pulled in with default features off and
  `rustls` on, so `HttpSink` does not need OpenSSL on the build host.
- **A readable machine ID, ideally.** `MachineId::derive` reads the host
  machine ID through `machine-uid` when the policy is `Enabled`. What
  happens when it cannot is covered in
  [Machine identity]../explanation/machine-identity.md.

## Always-on dependencies

`machine-uid`, `sha2`, `tokio`, `async-trait`, `serde`, `serde_json`,
`thiserror`, `miette`, `time`, `toml`, `uuid` and
[`rtb-redact`](https://redact.rust.phpboyscout.uk).

`rtb-redact` is not optional. It is what redaction is made of, and making
it optional would let a build silently drop the scrubbing step from the
sinks that write off-process.

## Safety

`src/lib.rs` carries `#![forbid(unsafe_code)]` — the crate contains no
`unsafe` blocks and cannot grow one without the compiler refusing.