Be more tolerant to invalid JSON when parsing dashboards for indexing (#114040)
* Tags can only be string array. * Be more lenient when parsing dashboard. Parse what we can, don't error out easily. * Check element before parsing, log unexpected types.
This commit is contained in:
@@ -261,7 +261,10 @@ func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resou
|
||||
value = rsp.Value
|
||||
}
|
||||
|
||||
summary, err := dashboard.ReadDashboard(bytes.NewReader(value), s.DatasourceLookup)
|
||||
summary, err := dashboard.ReadDashboardWithLogContext(bytes.NewReader(value), s.DatasourceLookup, map[string]any{
|
||||
"document": fmt.Sprintf("%s/%s/%s/%s", key.GetNamespace(), key.GetGroup(), key.GetResource(), key.GetName()),
|
||||
"rv": rv,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user