orangeCatDeveloper opened a new pull request, #4310: URL: https://github.com/apache/hertzbeat/pull/4310
## What's changed? Fixes #1481: Windows SNMP interface descriptions carry NUL padding bytes (`\^@`). The TDengine history storage builds its INSERT by hand, so the NUL reached the SQL text, TDengine rejected it with error 216, and the whole batch was lost — including the healthy rows. Fix in `TdEngineDataStorage.formatStringValue`, the single choke point all string values, labels json and the instance tag pass through: - strip `` before anything else (only NUL — tabs/newlines are legitimate data) - truncate the logical value **before** SQL-escaping: the old escape-then-truncate order could cut an escape pair like `\'` in half, leaving a dangling backslash that escapes the closing quote and kills the batch the same way Only TDengine is affected: the other history backends use typed clients / JSON / line protocol instead of hand-built SQL. Verified against a real TDengine 3.3.5.0 with a metric whose string value ends in ``: ``` before: TDengine ERROR (216) ... syntax error near ''Software Loopback Interface 1' — 0 rows stored after: no errors — rows stored, value clean: 'Software Loopback Interface 1' ``` ## Checklist - [x] I have read the [Contributing Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide) - [x] I have written the necessary doc or comment. - [x] I have added the necessary unit tests and all cases have passed. ## Add or update API - [ ] I have added the necessary [e2e tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have passed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
