Skip to content

[fix] persist custom monitor labels when writing to GreptimeDB#4151

Open
wilmerdooley wants to merge 1 commit into
apache:masterfrom
wilmerdooley:oss/issue-4124
Open

[fix] persist custom monitor labels when writing to GreptimeDB#4151
wilmerdooley wants to merge 1 commit into
apache:masterfrom
wilmerdooley:oss/issue-4124

Conversation

@wilmerdooley

Copy link
Copy Markdown

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

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

Signed-off-by: wilmerdooley <wilmerdooley1@gmail.com>
@wilmerdooley wilmerdooley changed the title fix(warehouse): persist custom monitor labels in GreptimeDB [fix] persist custom monitor labels when writing to GreptimeDB Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Metrics labels not written to GreptimeDB but present in VictoriaMetrics (HertzBeat 1.8.0)

1 participant