[package] name = "rustfoundry" description = "A Rust service rustfoundry library." version = { workspace = true } edition = { workspace = true } repository = { workspace = true } authors = { workspace = true } license = { workspace = true } readme = "../README.md" documentation = "https://docs.rs/rustfoundry" categories = [ "config", "development-tools", "external-ffi-bindings", "memory-management", ] keywords = ["service", "telemetry", "settings", "seccomp", "metrics"] [package.metadata.release] # run in the context of workspace root pre-release-hook = [ "git-cliff", "-w", "..", "-o", "../RELEASE_NOTES.md", "--tag", "{{version}}", ] [features] # Default set of features. default = ["platform-common-default", "security"] # All non platform-specific features platform-common-default = [ "settings", "jemalloc", "telemetry", "cli", "testing", "settings_deny_unknown_fields_by_default", "panic_on_too_much_logger_nesting", ] # A subset of features that can be used both on server and client sides. Useful for libraries # that can be used either way. server-client-common-default = ["settings", "client-telemetry", "testing"] # Enables serializable documented settings functionality. settings = [ "dep:rustfoundry-macros", "dep:serde_path_to_error", "dep:serde_yaml", "dep:serde", "dep:yaml-merge-keys", "dep:indexmap", ] # Whether settings structs annotated with `#[settings]` will, by default, error on unknown fields. settings_deny_unknown_fields_by_default = ["rustfoundry-macros?/settings_deny_unknown_fields_by_default"] # Enables all the telemetry-related features ("logging", "metrics", "tracing", "telemetry-server"). telemetry = [ "logging", "memory-profiling", "metrics", "tracing", "telemetry-server", "client-telemetry", "telemetry-otlp-grpc", "dep:futures-util", ] # Enables a subset of telemetry features suitable for usage in clients. client-telemetry = ["logging", "metrics", "tracing", "dep:futures-util"] # Enables the telemetry server. telemetry-server = [ "dep:hyper", "dep:socket2", "dep:percent-encoding" ] # Enables telemetry reporting over gRPC telemetry-otlp-grpc = ["dep:tonic", "dep:tokio", "dep:hyper"] # Enables experimental tokio runtime metrics tokio-runtime-metrics = [ "tokio/rt", "metrics", "serde/rc", "dep:slab", ] # Enables logging functionality. logging = [ "dep:governor", "dep:once_cell", "dep:parking_lot", "dep:slog-async", "dep:slog-json", "dep:slog-term", "dep:slog", "dep:thread_local", "dep:futures-util", "dep:serde", ] # Enables distributed tracing functionality. tracing = [ "dep:rustfoundry-macros", "dep:governor", "dep:once_cell", "dep:parking_lot", "dep:rand", "dep:cf-rustracing-jaeger", "dep:cf-rustracing", "dep:opentelemetry-proto", "dep:thread_local", "dep:futures-util", "dep:tokio", "dep:serde", ] # Enables metrics functionality. metrics = [ "dep:rustfoundry-macros", "dep:erased-serde", "dep:once_cell", "dep:parking_lot", "dep:prometheus-client", "dep:prometheus", "dep:prometools", "dep:serde_with", "dep:serde", "dep:futures-util", ] # Enables memory profiling features (require `jemalloc` feature to be enabled) memory-profiling = [ "dep:once_cell", "dep:tikv-jemalloc-ctl", "dep:tempfile", "dep:tokio", "jemalloc", ] # Enables security-related features security = ["dep:bindgen", "dep:cc", "dep:once_cell"] # Enables jemalloc as a memory allocator jemalloc = ["dep:tikv-jemallocator"] # Enables command line interface functionality. cli = ["settings", "dep:clap"] # Enables testing-related functionality. testing = ["dep:rustfoundry-macros"] # Enables panicking when too much nesting is reached on the logger panic_on_too_much_logger_nesting = [] [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable", "--cfg", "rustfoundry_unstable"] # it's necessary to _also_ pass `--cfg tokio_unstable` and `--cfg rustfoundry_unstable` # to rustc, or else dependencies will not be enabled, and the docs build will fail. rustc-args = ["--cfg", "tokio_unstable", "--cfg", "rustfoundry_unstable"] [dependencies] anyhow = { workspace = true, features = ["backtrace", "std"] } rustfoundry-macros = { workspace = true, optional = true, default-features = false } cf-rustracing = { workspace = true, optional = true } cf-rustracing-jaeger = { workspace = true, optional = true } clap = { workspace = true, optional = true } erased-serde = { workspace = true, optional = true } futures-util = { workspace = true, optional = true } governor = { workspace = true, optional = true } hyper = { workspace = true, optional = true, features = [ "http1", "runtime", "server", ] } indexmap = { workspace = true, optional = true, features = ["serde"] } once_cell = { workspace = true, optional = true } opentelemetry-proto = { workspace = true, optional = true, features = ["gen-tonic-messages", "trace"] } parking_lot = { workspace = true, optional = true } percent-encoding = { workspace = true, optional = true } prometheus = { workspace = true, optional = true, features = ["process"] } prometheus-client = { workspace = true, optional = true } prometools = { workspace = true, optional = true, features = ["serde"] } rand = { workspace = true, optional = true } serde = { workspace = true, optional = true, features = ["derive", "rc"] } serde_path_to_error = { workspace = true, optional = true } serde_yaml = { workspace = true, optional = true } serde_with = { workspace = true, optional = true } slab = { workspace = true, optional = true } slog = { workspace = true, optional = true, features = ["max_level_trace"] } slog-async = { workspace = true, optional = true } slog-json = { workspace = true, optional = true } slog-term = { workspace = true, optional = true } socket2 = { workspace = true, optional = true } thread_local = { workspace = true, optional = true } tokio = { workspace = true, optional = true, features = ["sync", "rt"] } tonic = { workspace = true, optional = true, features = ["channel", "transport"] } tikv-jemallocator = { workspace = true, optional = true, features = [ "profiling", "stats", "background_threads", ] } yaml-merge-keys = { workspace = true, optional = true, features = [ "serde_yaml", ] } # needed for minver purposes async-stream = { workspace = true, optional = true } local-ip-address = { workspace = true, optional = true } lock_api = { workspace = true, optional = true } log = { workspace = true, optional = true } parking_lot_core = { workspace = true, optional = true } regex = { workspace = true, optional = true } thiserror = { workspace = true, optional = true } [target.'cfg(target_os = "linux")'.dependencies] tikv-jemalloc-ctl = { workspace = true, optional = true, features = [ "use_std", ] } tempfile = { workspace = true, optional = true } # needed for minver purposes neli = { workspace = true, optional = true } neli-proc-macros = { workspace = true, optional = true } [dev-dependencies] reqwest = { workspace = true } serde = { workspace = true, features = ["rc"] } tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } ipnetwork = { workspace = true } [build-dependencies] bindgen = { workspace = true, features = ["runtime"], optional = true } cc = { workspace = true, optional = true }