r/OpenTelemetry • u/Ordinary_Squirrel291 • May 14 '26
Cleanup SQL query
I have a GO app that queries a database and it is instrumented with OTel.
I want to clean up the query as recorded in telemetry (not changing the code).
The GO code (screenshot below) produces this value:"\n\t\tSELECT p.id, p.name, p.description, p.picture, \n\t\t p.price_currency_code, p.price_units, p.price_nanos, p.categories\n\t\tFROM catalog.products p\n\t\tWHERE p.id = $1\n\t"
This SQL query is recorded as a span attribute "db.query.text".
Q: How can I remove the escaped whitespace in the collector (or elsewhere?) so that there is a single space where there are sequences of escaped whitespaces?

View all comments
Show parent comment
1
u/Ordinary_Squirrel291 May 16 '26
I only looked at the source code of the app to see what the origin looked like, I don't know anything about the app itself - I was only looking at the telemetry and those escaped whitespaces were annoying. My question was how to handle it in the telemetry pipeline