wilmerdooley opened a new pull request, #4151: URL: https://github.com/apache/hertzbeat/pull/4151
## What's changed? `GreptimeDbDataStorage.saveData` previously ignored the custom labels returned by `MetricsData.getLabels()` when building the GreptimeDB `Table`, so monitor labels were silently dropped on write. The fix mirrors how `VictoriaMetricsDataStorage` and `DorisDataStorage` persist labels: each non-colliding custom label is added as a `String` tag column on the table schema, and its value is appended to the row after the field columns. To preserve existing field column ordering, the row value array is sized as `2 + fields.size() + labelKeys.size()` and label values are written at index `2 + fields.size() + i`. Reserved keys that would collide with the built-in `instance` and `ts` columns, or with an existing field name, are skipped. A regression test in `GreptimeDbDataStorageTest` captures the written `Table` with an `ArgumentCaptor` and asserts the custom label appears as a `TAG` column and that its value is present in the row. Resolves #4124 ## Checklist - [x] I have read the [Contributing Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide) - [ ] 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]
