forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.rs
More file actions
128 lines (116 loc) · 3.25 KB
/
lib.rs
File metadata and controls
128 lines (116 loc) · 3.25 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
#![recursion_limit = "256"] // for async-stream
#![allow(clippy::approx_constant)]
#![allow(clippy::float_cmp)]
#![allow(clippy::blocks_in_if_conditions)]
#![allow(clippy::match_wild_err_arm)]
#![allow(clippy::new_ret_no_self)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::trivial_regex)]
#![allow(clippy::type_complexity)]
#![allow(clippy::unit_arg)]
#![deny(clippy::clone_on_ref_ptr)]
#![deny(clippy::trivially_copy_pass_by_ref)]
#![deny(clippy::disallowed_method)] // [nursery] mark some functions as verboten
#![deny(clippy::missing_const_for_fn)] // [nursery] valuable to the optimizer,
// but may produce false positives
#[macro_use]
extern crate tracing;
#[macro_use]
extern crate derivative;
#[cfg(feature = "vrl-cli")]
extern crate vrl_cli;
#[macro_use]
pub mod config;
pub mod cli;
pub mod conditions;
pub mod dns;
#[cfg(feature = "docker")]
pub mod docker;
pub mod expiring_hash_map;
pub mod generate;
#[macro_use]
pub mod internal_events;
#[cfg(feature = "api")]
pub mod api;
pub mod app;
pub mod async_read;
pub mod buffers;
#[cfg(feature = "codecs")]
pub mod codecs;
pub mod encoding_transcode;
pub mod enrichment_tables;
pub mod graph;
pub mod heartbeat;
pub mod http;
#[cfg(any(feature = "sources-kafka", feature = "sinks-kafka"))]
pub(crate) mod kafka;
pub mod kubernetes;
pub mod line_agg;
pub mod list;
pub(crate) mod pipeline;
pub(crate) mod proto;
pub mod providers;
#[cfg(feature = "rusoto_core")]
pub mod rusoto;
pub mod serde;
#[cfg(windows)]
pub mod service;
pub mod shutdown;
pub mod signal;
pub mod sink;
pub mod sinks;
pub mod sources;
pub(crate) mod stats;
pub mod stream;
#[cfg(feature = "api-client")]
mod tap;
pub mod tcp;
pub mod template;
pub mod test_util;
pub mod tls;
#[cfg(feature = "api-client")]
pub mod top;
pub mod topology;
pub mod trace;
pub mod transforms;
pub mod trigger;
pub mod types;
pub mod udp;
pub mod unit_test;
pub(crate) mod utilization;
pub mod validate;
#[cfg(windows)]
pub mod vector_windows;
pub use pipeline::Pipeline;
pub use vector_core::{event, mapping, metrics, Error, Result};
pub fn vector_version() -> impl std::fmt::Display {
#[cfg(feature = "nightly")]
let pkg_version = format!("{}-nightly", built_info::PKG_VERSION);
#[cfg(not(feature = "nightly"))]
let pkg_version = built_info::PKG_VERSION;
pkg_version
}
pub fn get_version() -> String {
let pkg_version = vector_version();
let build_desc = built_info::VECTOR_BUILD_DESC;
let build_string = match build_desc {
Some(desc) => format!("{} {}", built_info::TARGET, desc),
None => built_info::TARGET.into(),
};
// We do not add 'debug' to the BUILD_DESC unless the caller has flagged on line
// or full debug symbols. See the Cargo Book profiling section for value meaning:
// https://doc.rust-lang.org/cargo/reference/profiles.html#debug
let build_string = match built_info::DEBUG {
"1" => format!("{} debug=line", build_string),
"2" | "true" => format!("{} debug=full", build_string),
_ => build_string,
};
format!("{} ({})", pkg_version, build_string)
}
#[allow(unused)]
pub mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
pub fn get_hostname() -> std::io::Result<String> {
Ok(hostname::get()?.to_string_lossy().into())
}