Expand description
Walks src/**/*.rs and lib/**/*.rs, extracts internal-event definitions
and tracing log calls via syn’s AST, and validates them against the
rules in docs/specs/instrumentation.md. Macro argument scraping (the
contents of counter!(...), trace!(...), etc.) uses small targeted
regexes on the macro’s already-tokenised input — never on raw source.
Structs§
- Cli 🔒
- Check that internal events satisfy the patterns set in https://github.com/vectordotdev/vector/blob/master/docs/specs/instrumentation.md.
- Event 🔒
- Event
Class 🔒 - ImplCtx 🔒
- LogCall 🔒
- Parsed
Log 🔒 - Parsed
Metric 🔒 - Scanner 🔒
- Skip
Flags 🔒
Constants§
Statics§
- RE_
EMIT_ 🔒DROPPED emit!(ComponentEventsDropped...)detection regex, applied to the raw source slice of an impl block (which preserves comments and original formatting thatto_token_streamstrips).- RE_
LOG_ 🔒CALL_ OPEN - Locator for
tracinglog-macro calls (trace!(,debug!(,info!(,warn!(,error!() in raw source text. Used by the format-check pass because the AST visitor cannot see log calls nested inside opaque outer macros liketokio::select!. - RE_
TAG_ 🔒PAIR "key" => valuetag-pair regex. Used insidecounter!(...)arg lists. Note: syn’sTokenStreamrendering may produce=>as= >; the regex accepts either form via=[ \t]*>.- RE_USES 🔒
emit!(EventName)/register!(Path::EventName)use-counting regex, applied to the raw file text so it sees calls nested inside other macros (e.g.tokio::select!) thatsyndoes not descend into.
Functions§
- check_
error_ 🔒counter_ tag_ constants - check_
error_ 🔒event - check_
event_ 🔒class - check_
events_ 🔒dropped - collect_
source_ 🔒paths - counters_
must_ 🔒include_ exclude_ tags - first_
ident 🔒 - Pull the first identifier-shaped substring out of a token text.
- format_
check_ 🔒log_ messages - Format-check every
tracinglog macro invocation intext(a Rust source file’s contents). Returns a list of human-readable report lines. - is_
identifier 🔒 - log_
level_ 🔒one_ of - match_
paren_ 🔒end - Given a string starting with
(, find the index of the matching). - normalize_
value 🔒 - Strip whitespace introduced by
TokenStream::to_stringaround::soerror_stage :: PROCESSINGbecomeserror_stage::PROCESSINGfor the constant-prefix validation (starts_with("error_stage::")). - parameter_
name 🔒 - Extract the parameter name from a log-macro arg.
tracingaccepts:name = expr,?name,%name, and barename. Token-stream serialisation puts whitespace around punctuation (% protocol) so we trim after stripping each prefix. - parse_
log_ 🔒args - Parse a
trace!(...)/debug!(...)/info!(...)/warn!(...)/error!(...)invocation’s already-stringified args into the message text and the list of parameter names it carries. - parse_
metric_ 🔒args - Parse a
counter!(...)/gauge!(...)/histogram!(...)invocation’s already-tokenised args into a name (string literal orCamelCasevariant of<X>Name::Variant) and its"key" => valuetag pairs. - parse_
metric_ 🔒name - Extract the metric name from the first arg of a
counter!/gauge!/histogram!. Accepts"literal"or<TypeName>::<Variant>. - report_
event_ 🔒errors - scan_
file 🔒 - source_
slice 🔒 - Extract the source slice covered by a
proc_macro2::Span. Used to read line-comment skip markers (e.g.## skip check-validity-events ##) whichsyndiscards from the AST. - split_
brace_ 🔒block - Split a
{ ... }block off the front ofs, returning(inside, rest). - split_
comma_ 🔒args - Split a token stream that represents a comma-separated argument list into per-argument substrings, respecting bracket/paren/brace nesting and string literals. Operates on the (already-bounded) macro-arg token text.
- validate_
all 🔒 - validate_
event 🔒