Skip to content

Commit ba63e21

Browse files
docs: Add a quickfix to handle special capitalization cases (#17141)
* docs: Add a quickfix to handle special capitalization cases Signed-off-by: Spencer Gilbert <[email protected]> * +amqp Signed-off-by: Spencer Gilbert <[email protected]> * +pr feedback Signed-off-by: Spencer Gilbert <[email protected]> --------- Signed-off-by: Spencer Gilbert <[email protected]>
1 parent db39d83 commit ba63e21

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

lib/vector-config-macros/src/configurable_component.rs

+19-4
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,26 @@ pub fn configurable_component_impl(args: TokenStream, item: TokenStream) -> Toke
400400
derived.into()
401401
}
402402

403+
// Properly capitalize labels, accounting for some exceptions
404+
// TODO: Replace this with an explicit requirement for a "component_human_name" or similar.
403405
fn capitalize(s: &str) -> String {
404-
let mut iter = s.chars();
405-
match iter.next() {
406-
None => String::new(),
407-
Some(first) => first.to_uppercase().collect::<String>() + iter.as_str(),
406+
match s {
407+
"Amqp" | "Aws" | "Ec2" | "Ecs" | "Gcp" | "Hec" | "Http" | "Nats" | "Nginx" | "Sqs" => {
408+
s.to_uppercase()
409+
}
410+
"Eventstoredb" => String::from("EventStoreDB"),
411+
"Mongodb" => String::from("MongoDB"),
412+
"Opentelemetry" => String::from("OpenTelemetry"),
413+
"Postgresql" => String::from("PostgreSQL"),
414+
"Pubsub" => String::from("Pub/Sub"),
415+
"Statsd" => String::from("StatsD"),
416+
_ => {
417+
let mut iter = s.chars();
418+
match iter.next() {
419+
None => String::new(),
420+
Some(first) => first.to_uppercase().collect::<String>() + iter.as_str(),
421+
}
422+
}
408423
}
409424
}
410425

0 commit comments

Comments
 (0)