-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
316 lines (299 loc) · 22.5 KB
/
Cargo.toml
File metadata and controls
316 lines (299 loc) · 22.5 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
[package]
name = "litemon"
version = "0.2.3"
edition = "2024"
rust-version = "1.85.0"
description = "A very minimal and lightweight metric collector for Linux systems"
license = "MIT OR Apache-2.0"
authors = ["Arvid Gerstmann <github@arvid.io>"]
homepage = "https://github.com/ragnarlab/litemon"
repository = "https://github.com/ragnarlab/litemon"
keywords = ["prometheus", "monitoring", "linux", "grafana"]
categories = ["command-line-utilities"]
readme = "README.md"
[package.metadata.nfpm]
epoch = "1"
contents = [
{ src = "./examples/config.kdl", dst = "/etc/litemon/config.kdl.example" },
{ src = "./litemon.service", dst = "/etc/systemd/system/litemon.service" },
]
# Keyid found with:
# `gpg --list-keys --with-colons <ID-FROM-LIST-KEYS> | awk -F: '/^pub:/ { print $5 }'`
[package.metadata.nfpm.deb.signature]
key_file = "private-key.gpg"
# https://superuser.com/a/769488
key_id = "4568437E29814F91"
[package.metadata.nfpm.rpm.signature]
key_file = "private-key.gpg"
# https://superuser.com/a/769488
key_id = "4568437E29814F91"
[profile.dev]
# This provides only line-tables and not full debug information necessary for
# debugging under `gcc` or `lldb`. Turn this to "full" (or 2) when full debug
# information are necessary.
debug = "limited"
opt-level = 0
[profile.release]
incremental = false
codegen-units = 1
strip = "none"
split-debuginfo = "off"
overflow-checks = true
debug-assertions = false
# Set this to 1 or 2 to get more useful backtraces in debugger.
debug = "line-tables-only"
lto = "thin"
# To speed up generation of stacktraces during development.
[profile.dev.package.backtrace]
opt-level = 3
[dependencies]
anyhow = "1"
hashbrown = ">=0.15.1"
lexopt = "0.3"
# Async runtimes & utilities
smol = "2"
smol-hyper = "0.1"
futures-concurrency = "7"
# Tracing
tracing = { version = "0.1", default-features = false, features = [] }
tracing-logfmt = { version = "0.3", features = ["ansi_logs"] }
tracing-subscriber = { version = ">=0.3.20", features = ["env-filter", "tracing-log"] }
# HTTP
hyper = { version = "1", default-features = false, features = ["http1", "server"] }
http-body-util = "0.1"
http = "1.3"
# Configuration language.
kdl = "6.3"
# Required for systemd metrics.
zbus = { version = "5.3", default-features = false, features = [] }
zbus_systemd = { version = "0.25701", default-features = false, features = ["systemd1"] }
# Required for cpu/memory metrics.
procfs = "0.17"
# Required for filesystem metrics.
nix = { version = "0.30", features = ["fs"] }
# Required for outputting metrics in format understood by Prometheus
prometheus-client = { version = "0.24", default-features = false }
# Allocator
tikv-jemallocator = "0.6"
# tikv-jemalloc-sys = { version = "0.6", features = ["stats"] }
# tikv-jemalloc-ctl = { version = "0.6", features = ["stats", "use_std"] }
[dev-dependencies]
assert_cmd = "2"
predicates = "3"
[lints.clippy]
## lint groups
#
# This is the default from clippy.
complexity = { level = "warn", priority = -1 }
correctness = { level = "deny", priority = -1 }
perf = { level = "deny", priority = -1 }
restriction = { level = "allow", priority = -1 }
style = { level = "warn", priority = -1 }
suspicious = { level = "warn", priority = -1 }
# clippy has two further groups: "nursery" and "pedantic"
# Both are "allow" by default.
## deny the following lints:
# ("forbid" is a level above "deny" and won't allow override in the code)
#
unwrap_used = "deny" # using `.unwrap()` on `Result` or `Option`, which should at least get a better message using `expect()`
panic = "deny" # usage of the `panic!` macro
## allow following lints:
#
new_ret_no_self = "allow" # Builder pattern disagrees
useless_asref = "allow" # Has a bunch of false positives
assigning_clones = "allow" # Has false positives
unwrap_in_result = "allow" # functions of type `Result<..>` or `Option`<...> that contain `expect()` or `unwrap()`
# pedantic/nursery/restriction lints:
assertions_on_result_states = "warn" # `assert!(r.is_ok())`/`assert!(r.is_err())` gives worse error message than directly calling `r.unwrap()`/`r.unwrap_err()`
as_ptr_cast_mut = "warn" # casting the result of the `&self`-taking `as_ptr` to a mutable pointer
as_underscore = "warn" # detects `as _` conversion
bool_to_int_with_if = "warn" # using if to convert bool to int
borrow_as_ptr = "warn" # borrowing just to cast to a raw pointer
branches_sharing_code = "warn" # `if` statement with shared code in all blocks
cast_lossless = "warn" # casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`
cast_precision_loss = "warn" # casts that cause loss of precision, e.g., `x as f32` where `x: u64`
cast_ptr_alignment = "warn" # cast from a pointer to a more-strictly-aligned pointer
clear_with_drain = "warn" # calling `drain` in order to `clear` a container
cloned_instead_of_copied = "warn" # used `cloned` where `copied` could be used instead
clone_on_ref_ptr = "warn" # using 'clone' on a ref-counted pointer
cognitive_complexity = "warn" # functions that should be split up into multiple functions
collection_is_never_read = "warn" # a collection is never queried
copy_iterator = "warn" # implementing `Iterator` on a `Copy` type
create_dir = "warn" # calling `std::fs::create_dir` instead of `std::fs::create_dir_all`
debug_assert_with_mut_call = "warn" # mutable arguments in `debug_assert{,_ne,_eq}!`
decimal_literal_representation = "warn" # using decimal representation when hexadecimal would be better
default_numeric_fallback = "warn" # usage of unconstrained numeric literals which may cause default numeric fallback.
default_union_representation = "warn" # unions without a `# [repr(C)]` attribute
derive_partial_eq_without_eq = "warn" # deriving `PartialEq` on a type that can implement `Eq`, without implementing `Eq`
disallowed_script_idents = "warn" # usage of non-allowed Unicode scripts
doc_link_with_quotes = "warn" # possible typo for an intra-doc link
empty_drop = "warn" # empty `Drop` implementations
empty_enum = "warn" # enum with no variants
enum_glob_use = "warn" # use items that import all variants of an enum
equatable_if_let = "warn" # using pattern matching instead of equality
error_impl_error = "warn" # exported types named `Error` that implement `Error`
exit = "warn" # detects `std::process::exit` calls
explicit_deref_methods = "warn" # Explicit use of deref or deref_mut method while not in a method chain.
explicit_into_iter_loop = "warn" # for-looping over `_.into_iter()` when `_` would do
explicit_iter_loop = "warn" # for-looping over `_.iter()` or `_.iter_mut()` when `&_` or `&mut _` would do
expl_impl_clone_on_copy = "warn" # implementing `Clone` explicitly on `Copy` types
fallible_impl_from = "warn" # Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`
filetype_is_file = "warn" # `FileType::is_file` is not recommended to test for readable file type
filter_map_next = "warn" # using combination of `filter_map` and `next` which can usually be written as a single method call
flat_map_option = "warn" # used `flat_map` where `filter_map` could be used instead
float_cmp = "warn" # using `==` or `!=` on float values instead of comparing difference with an epsilon
float_cmp_const = "warn" # using `==` or `!=` on float constants instead of comparing difference with an epsilon
fn_params_excessive_bools = "warn" # using too many bools in function parameters
fn_to_numeric_cast_any = "warn" # casting a function pointer to any integer type
format_push_string = "warn" # `format!(..)` appended to existing `String`
from_iter_instead_of_collect = "warn" # use `.collect()` instead of `::from_iter()`
future_not_send = "warn" # public Futures must be Send
get_unwrap = "warn" # using `.get().unwrap()` or `.get_mut().unwrap()` when using `[]` would work instead
implicit_clone = "warn" # implicitly cloning a value by invoking a function on its dereferenced type
implicit_hasher = "warn" # missing generalization over different hashers
impl_trait_in_params = "warn" # `impl Trait` is used in the function's parameters
imprecise_flops = "warn" # usage of imprecise floating point operations
inconsistent_struct_constructor = "warn" # the order of the field init shorthand is inconsistent with the order in the struct definition
index_refutable_slice = "warn" # avoid indexing on slices which could be destructed
inefficient_to_string = "warn" # using `to_string` on `&&T` where `T: ToString`
infinite_loop = "warn" # possibly unintended infinite loop
inline_always = "warn" # use of `# [inline(always)]`
inline_asm_x86_att_syntax = "warn" # prefer Intel x86 assembly syntax
into_iter_without_iter = "warn" # implementing `IntoIterator for (&|&mut) Type` without an inherent `iter(_mut)` method
invalid_upcast_comparisons = "warn" # a comparison involving an upcast which is always true or false
items_after_statements = "warn" # blocks where an item comes after a statement
iter_filter_is_ok = "warn" # filtering an iterator over `Result`s for `Ok` can be achieved with `flatten`
iter_filter_is_some = "warn" # filtering an iterator over `Option`s for `Some` can be achieved with `flatten`
iter_not_returning_iterator = "warn" # methods named `iter` or `iter_mut` that do not return an `Iterator`
iter_on_empty_collections = "warn" # Iterator for empty array
iter_on_single_items = "warn" # Iterator for array of length 1
iter_without_into_iter = "warn" # implementing `iter(_mut)` without an associated `IntoIterator for (&|&mut) Type` impl
iter_with_drain = "warn" # replace `.drain(..)` with `.into_iter()`
large_digit_groups = "warn" # grouping digits into groups that are too large
large_futures = "warn" # large future may lead to unexpected stack overflows
large_include_file = "warn" # including a large file
large_stack_arrays = "warn" # allocating large arrays on stack may cause stack overflow
large_stack_frames = "warn" # checks for functions that allocate a lot of stack space
large_types_passed_by_value = "warn" # functions taking large arguments by value
let_underscore_must_use = "warn" # non-binding `let` on a `# [must_use]` expression
linkedlist = "warn" # usage of LinkedList, usually a vector is faster, or a more specialized data structure like a `VecDeque`
lossy_float_literal = "warn" # lossy whole number float literals
macro_use_imports = "warn" # # [macro_use] is no longer needed
manual_assert = "warn" # `panic!` and only a `panic!` in `if`-then statement
manual_c_str_literals = "warn" # creating a `CStr` through functions when `c""` literals can be used
manual_instant_elapsed = "warn" # subtraction between `Instant::now()` and previous `Instant`
manual_is_variant_and = "warn" # using `.map(f).unwrap_or_default()`, which is more succinctly expressed as `is_some_and(f)` or `is_ok_and(f)`
manual_let_else = "warn" # manual implementation of a let...else statement
manual_ok_or = "warn" # finds patterns that can be encoded more concisely with `Option::ok_or`
manual_string_new = "warn" # empty String is being created manually
many_single_char_names = "warn" # too many single character bindings
map_err_ignore = "warn" # `map_err` should not ignore the original error
map_unwrap_or = "warn" # using `.map(f).unwrap_or(a)` or `.map(f).unwrap_or_else(func)`, which are more succinctly expressed as `map_or(a, f)` or `map_or_else(a, f)`
match_bool = "warn" # a `match` on a boolean expression instead of an `if..else` block
match_same_arms = "warn" # `match` with identical arm bodies
match_wild_err_arm = "warn" # a `match` with `Err(_)` arm and take drastic actions
maybe_infinite_iter = "warn" # possible infinite iteration
mem_forget = "warn" # `mem::forget` usage on `Drop` types, likely to cause memory leaks
mismatching_type_param_order = "warn" # type parameter positioned inconsistently between type def and impl block
missing_assert_message = "warn" # checks assertions without a custom panic message
missing_panics_doc = "warn" # `pub fn` may panic without `# Panics` in doc comment
multiple_inherent_impl = "warn" # Multiple inherent impl that could be grouped
multiple_unsafe_ops_per_block = "warn" # more than one unsafe operation per `unsafe` block
mut_mut = "warn" # usage of double-mut refs, e.g., `&mut &mut ...`
naive_bytecount = "warn" # use of naive `<slice>.filter(|&x| x == y).count()` to count byte values
needless_bitwise_bool = "warn" # Boolean expressions that use bitwise rather than lazy operators
needless_collect = "warn" # collecting an iterator when collect is not needed
needless_for_each = "warn" # using `for_each` where a `for` loop would be simpler
needless_pass_by_ref_mut = "warn" # using a `&mut` argument when it's not mutated
needless_pass_by_value = "warn" # functions taking arguments by value, but not consuming them in its body
negative_feature_names = "warn" # usage of a negative feature name
nonstandard_macro_braces = "warn" # check consistent use of braces in macro
non_ascii_literal = "warn" # using any literal non-ASCII chars in a string literal instead of using the `\u` escape
non_send_fields_in_send_ty = "warn" # there is a field that is not safe to be sent to another thread in a `Send` struct
no_effect_underscore_binding = "warn" # binding to `_` prefixed variable with no side-effect
no_mangle_with_rust_abi = "warn" # convert Rust ABI functions to C ABI
option_as_ref_cloned = "warn" # cloning an `Option` via `as_ref().cloned()`
option_if_let_else = "warn" # reimplementation of Option::map_or
option_option = "warn" # usage of `Option<Option<T>>`
or_fun_call = "warn" # using any `*or` method with a function call, which suggests `*or_else`
partial_pub_fields = "warn" # partial fields of a struct are public
path_buf_push_overwrite = "warn" # calling `push` with file system root on `PathBuf` can overwrite it
ptr_as_ptr = "warn" # casting using `as` from and to raw pointers that doesn't change its mutability, where `pointer::cast` could take the place of `as`
ptr_cast_constness = "warn" # casting using `as` from and to raw pointers to change constness when specialized methods apply
pub_underscore_fields = "warn" # struct field prefixed with underscore and marked public
pub_without_shorthand = "warn" # disallows usage of `pub(in <loc>)` with `in`
rc_buffer = "warn" # shared ownership of a buffer type
rc_mutex = "warn" # usage of `Rc<Mutex<T>>`
read_zero_byte_vec = "warn" # checks for reads into a zero-length `Vec`
redundant_clone = "warn" # `clone()` of an owned value that is going to be dropped immediately
redundant_else = "warn" # `else` branch that can be removed without changing semantics
redundant_feature_names = "warn" # usage of a redundant feature name
redundant_type_annotations = "warn" # warns about needless / redundant type annotations.
ref_as_ptr = "warn" # using `as` to cast a reference to pointer
ref_binding_to_reference = "warn" # `ref` binding to a reference
ref_option_ref = "warn" # use `Option<&T>` instead of `&Option<&T>`
rest_pat_in_fully_bound_structs = "warn" # a match on a struct that binds all fields but still uses the wildcard pattern
return_self_not_must_use = "warn" # missing `# [must_use]` annotation on a method returning `Self`
same_functions_in_if_condition = "warn" # consecutive `if`s with the same function call
same_name_method = "warn" # two method with same name
self_named_module_files = "warn" # checks that module layout is consistent
semicolon_if_nothing_returned = "warn" # add a semicolon if nothing is returned
semicolon_inside_block = "warn" # add a semicolon inside the block
shadow_same = "warn" # rebinding a name to itself, e.g., `let mut x = &mut x`
shadow_unrelated = "warn" # rebinding a name without even using the original value
should_panic_without_expect = "warn" # ensures that all `should_panic` attributes specify its expected panic message
significant_drop_in_scrutinee = "warn" # warns when a temporary of a type with a drop with a significant side-effect might have a surprising lifetime
similar_names = "warn" # similarly named items and bindings
single_match_else = "warn" # a `match` statement with two arms where the second arm's pattern is a placeholder instead of a specific match pattern
stable_sort_primitive = "warn" # use of sort() when sort_unstable() is equivalent
string_add = "warn" # using `x + ..` where x is a `String` instead of `push_str()`
string_add_assign = "warn" # using `x = x + ..` where x is a `String` instead of `push_str()`
string_lit_as_bytes = "warn" # calling `as_bytes` on a string literal instead of using a byte string literal
string_lit_chars_any = "warn" # checks for `<string_lit>.chars().any(|i| i == c)`
string_slice = "warn" # slicing a string
string_to_string = "warn" # using `to_string()` on a `String`, which should be `clone()`
struct_excessive_bools = "warn" # using too many bools in a struct
str_split_at_newline = "warn" # splitting a trimmed string at hard-coded newlines
suboptimal_flops = "warn" # usage of sub-optimal floating point operations
suspicious_operation_groupings = "warn" # groupings of binary operations that look suspiciously like typos
suspicious_xor_used_as_pow = "warn" # XOR (`^`) operator possibly used as exponentiation operator
too_many_lines = "warn" # functions with too many lines
trailing_empty_array = "warn" # struct with a trailing zero-sized array but without `# [repr(C)]` or another `repr` attribute
trait_duplication_in_bounds = "warn" # check if the same trait bounds are specified more than once during a generic declaration
transmute_ptr_to_ptr = "warn" # transmutes from a pointer to a pointer / a reference to a reference
transmute_undefined_repr = "warn" # transmute to or from a type with an undefined representation
trivially_copy_pass_by_ref = "warn" # functions taking small copyable arguments by reference
try_err = "warn" # return errors explicitly rather than hiding them behind a `?`
tuple_array_conversions = "warn" # checks for tuple<=>array conversions that are not done with `.into()`
type_repetition_in_bounds = "warn" # types are repeated unnecessarily in trait bounds, use `+` instead of using `T: _, T: _`
unchecked_duration_subtraction = "warn" # finds unchecked subtraction of a 'Duration' from an 'Instant'
undocumented_unsafe_blocks = "warn" # creating an unsafe block without explaining why it is safe
unicode_not_nfc = "warn" # using a Unicode literal not in NFC normal form (see [Unicode tr15](http://www.unicode.org/reports/tr15/) for further information)
uninhabited_references = "warn" # reference to uninhabited type
uninlined_format_args = "warn" # using non-inlined variables in `format!` calls
unnecessary_box_returns = "warn" # Needlessly returning a Box
unnecessary_join = "warn" # using `.collect::<Vec<String>>().join("")` on an iterator
unnecessary_safety_comment = "warn" # annotating safe code with a safety comment
unnecessary_safety_doc = "warn" # `pub fn` or `pub trait` with `# Safety` docs
unnecessary_self_imports = "warn" # imports ending in `::{self}`, which can be omitted
unnecessary_wraps = "warn" # functions that only return `Ok` or `Some`
unneeded_field_pattern = "warn" # struct fields bound to a wildcard instead of using `..`
unnested_or_patterns = "warn" # unnested or-patterns, e.g., `Foo(Bar) | Foo(Baz) instead of `Foo(Bar | Baz)`
unreadable_literal = "warn" # long literal without underscores
unsafe_derive_deserialize = "warn" # deriving `serde::Deserialize` on a type that has methods using `unsafe`
unseparated_literal_suffix = "warn" # literals whose suffix is not separated by an underscore
unused_async = "warn" # finds async functions with no await statements
unused_peekable = "warn" # creating a peekable iterator without using any of its methods
unused_rounding = "warn" # Uselessly rounding a whole number floating-point literal
unused_self = "warn" # methods that contain a `self` argument but don't use it
used_underscore_binding = "warn" # using a binding which is prefixed with an underscore
useless_let_if_seq = "warn" # unidiomatic `let mut` declaration followed by initialization in `if`
use_debug = "warn" # use of `Debug`-based formatting
use_self = "warn" # unnecessary structure name repetition whereas `Self` is applicable
verbose_file_reads = "warn" # use of `File::read_to_end` or `File::read_to_string`
wildcard_dependencies = "warn" # wildcard dependencies being used
wildcard_imports = "warn" # lint `use _::*` statements
unnecessary_struct_initialization = "warn" # struct built from a base that can be written mode concisely
empty_enum_variants_with_brackets = "warn" # finds enum variants with empty brackets
case_sensitive_file_extension_comparisons = "warn" # Checks for calls to ends_with with case-sensitive file extensions
match_wildcard_for_single_variants = "warn" # a wildcard enum match for a single variant