vector/sources/util/
mod.rs1#![allow(missing_docs)]
2#[cfg(feature = "sources-http_server")]
3mod body_decoding;
4#[cfg(feature = "sources-file")]
5mod encoding_config;
6#[cfg(all(unix, feature = "sources-dnstap"))]
7pub mod framestream;
8#[cfg(any(feature = "sources-vector", feature = "sources-opentelemetry"))]
9pub mod grpc;
10#[cfg(any(
11 feature = "sources-utils-http-auth",
12 feature = "sources-utils-http-encoding",
13 feature = "sources-utils-http-headers",
14 feature = "sources-utils-http-prelude",
15 feature = "sources-utils-http-query"
16))]
17pub mod http;
18#[cfg(any(
19 feature = "sources-http_client",
20 feature = "sources-prometheus-scrape",
21 feature = "sources-okta"
22))]
23pub mod http_client;
24#[cfg(any(
25 feature = "sources-aws_sqs",
26 feature = "sources-gcp_pubsub",
27 feature = "sources-mqtt"
28))]
29mod message_decoding;
30pub mod multiline_config;
31#[cfg(any(feature = "sources-utils-net-tcp", feature = "sources-utils-net-udp"))]
32pub mod net;
33#[cfg(all(
34 unix,
35 any(feature = "sources-socket", feature = "sources-utils-net-unix",)
36))]
37pub mod unix;
38#[cfg(all(unix, feature = "sources-socket"))]
39mod unix_datagram;
40#[cfg(all(unix, feature = "sources-utils-net-unix"))]
41mod unix_stream;
42mod wrappers;
43
44#[cfg(feature = "sources-file")]
45pub use encoding_config::EncodingConfig;
46pub use multiline_config::MultilineConfig;
47#[cfg(all(
48 unix,
49 any(feature = "sources-socket", feature = "sources-utils-net-unix",)
50))]
51pub use unix::change_socket_permissions;
52#[cfg(all(unix, feature = "sources-socket",))]
53pub use unix_datagram::build_unix_datagram_source;
54#[cfg(all(unix, feature = "sources-utils-net-unix",))]
55pub use unix_stream::build_unix_stream_source;
56pub use wrappers::{AfterRead, AfterReadExt};
57
58#[cfg(feature = "sources-http_server")]
59pub use self::body_decoding::Encoding;
60#[cfg(feature = "sources-utils-http-prelude")]
61pub use self::http::HttpSource;
62#[cfg(feature = "sources-utils-http-headers")]
63pub use self::http::add_headers;
64#[cfg(feature = "sources-utils-http-query")]
65pub use self::http::add_query_parameters;
66#[cfg(any(
67 feature = "sources-prometheus-scrape",
68 feature = "sources-prometheus-remote-write",
69 feature = "sources-utils-http-encoding"
70))]
71pub use self::http::decompress_body;
72#[cfg(any(
73 feature = "sources-aws_sqs",
74 feature = "sources-gcp_pubsub",
75 feature = "sources-mqtt"
76))]
77pub use self::message_decoding::decode_message;
78
79#[cfg(any(feature = "sources-statsd", feature = "sources-datadog_agent"))]
86pub fn extract_tag_key_and_value<S: AsRef<str>>(
87 tag_chunk: S,
88) -> (String, vector_lib::event::metric::TagValue) {
89 use vector_lib::event::metric::TagValue;
90
91 let tag_chunk = tag_chunk.as_ref();
92
93 match tag_chunk.split_once(':') {
96 Some((prefix, suffix)) => (prefix.to_string(), TagValue::Value(suffix.to_string())),
98 None => (tag_chunk.to_string(), TagValue::Bare),
99 }
100}