Skip to main content

extract_sqlcommenter

Function extract_sqlcommenter 

Source
pub fn extract_sqlcommenter(sql: &str) -> Option<SqlCommenterTrace<'_>>
Expand description

Extract a sqlcommenter trace context from sql, if it carries one.

This function examines only genuine comment regions. SELECT '/*traceparent=…*/' is a string literal, not a comment, and gives None. That is the reason this function walks the statement instead of a match on the text.

The cost when no tag is present is one substring search. The scan starts only when the word traceparent appears somewhere in sql.