Fixed the bad classification issue.
This commit is contained in:
@@ -164,6 +164,7 @@ IGNORED_DISCOVERY_FIELDS = {
|
||||
"fgai_stream_id",
|
||||
"fgai_stream_name",
|
||||
}
|
||||
EMPTY_DISCOVERY_VALUES = {"", "-", "--", "unknown", "n/a", "none", "null", "nil", "undefined", "[]", "{}"}
|
||||
|
||||
|
||||
def _stream_id(event: LogEvent) -> str:
|
||||
@@ -182,6 +183,11 @@ def _is_number(value: str) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def _has_discovery_value(value: object) -> bool:
|
||||
text = str(value).strip()
|
||||
return text.lower() not in EMPTY_DISCOVERY_VALUES
|
||||
|
||||
|
||||
def _pick_present(priority: tuple[str, ...], coverage: Counter[str], total: int, *, min_ratio: float = 0.05, limit: int = 6) -> list[str]:
|
||||
selected = []
|
||||
for field in priority:
|
||||
@@ -436,7 +442,7 @@ def suggest_stream_profiles(events: list[LogEvent], *, existing_profiles: dict[s
|
||||
detector_counts: Counter[str] = Counter()
|
||||
for event in stream_events:
|
||||
for field, value in event.fields.items():
|
||||
if not value:
|
||||
if not _has_discovery_value(value):
|
||||
continue
|
||||
coverage[field] += 1
|
||||
if len(unique_values[field]) < 200:
|
||||
|
||||
Reference in New Issue
Block a user