GitHub user Duansg added a comment to the discussion: Discussion on fingerprint
generation logic
Regarding Question 1, I have some thoughts:
> Real time alert calculator
1. I initially considered adding `__row_index__` (row number) to the
fingerprint, but I cannot guarantee that the row number will always align with
the data row. This means there could be cases where identical data rows have
different row numbers. The pseudocode is as follows:
```
for (int i = 0; i < metricsData.getValues().size(); i++) {
boolean includeLabel = fields.stream().allMatch(CollectRep.Field::getLabel);
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
String valueStr = valueRow.getColumns(index);
final CollectRep.Field field = fields.get(index);
if (metricsData.getValues().size() > 1 && !includeLabel) {
fingerPrints.put("__row_index__", i);
}
}
}
```
2. Later, I attempted to incorporate `fieldName` and `value` into the
fingerprint to enhance uniqueness. However, I discovered that if `value` has a
high cardinality, it similarly compromises uniqueness. The pseudocode is as
follows:
```
boolean includeLabel = fields.stream().allMatch(CollectRep.Field::getLabel);
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
String valueStr = valueRow.getColumns(index);
final CollectRep.Field field = fields.get(index);
if (metricsData.getValues().size() > 1 && !includeLabel) {
fingerPrints.put(field.getName(), valueStr);
}
}
```
3. I attempted to scan the currently used monitoring templates. Although some
metrics lack labels, not all metrics exhibit multi-line issues. Under these
circumstances,
a. Inspect all metric information in hzb. If similar issues exist, configure
labels (supports composite labels).
b. Incremental checks for adding tags to new templates, accompanied by
documentation outlining best practices.
GitHub link:
https://github.com/apache/hertzbeat/discussions/3845#discussioncomment-14882672
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]