Module events

Module events 

Source
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 🔒
EventClass 🔒
ImplCtx 🔒
LogCall 🔒
ParsedLog 🔒
ParsedMetric 🔒
Scanner 🔒
SkipFlags 🔒

Constants§

BYTE_SIZE_COUNT 🔒
EVENT_CLASSES 🔒
METRIC_NAME_ERROR 🔒
METRIC_NAME_EVENTS_DROPPED 🔒

Statics§

RE_EMIT_DROPPED 🔒
emit!(ComponentEventsDropped...) detection regex, applied to the raw source slice of an impl block (which preserves comments and original formatting that to_token_stream strips).
RE_LOG_CALL_OPEN 🔒
Locator for tracing log-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 like tokio::select!.
RE_TAG_PAIR 🔒
"key" => value tag-pair regex. Used inside counter!(...) arg lists. Note: syn’s TokenStream rendering 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!) that syn does 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 tracing log macro invocation in text (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_string around :: so error_stage :: PROCESSING becomes error_stage::PROCESSING for the constant-prefix validation (starts_with("error_stage::")).
parameter_name 🔒
Extract the parameter name from a log-macro arg. tracing accepts: name = expr, ?name, %name, and bare name. 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 or CamelCase variant of <X>Name::Variant) and its "key" => value tag 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 ##) which syn discards from the AST.
split_brace_block 🔒
Split a { ... } block off the front of s, 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 🔒