fix: Reduce log spam on unknown relationship type (#1797)
Rather than log a warning for every instance of an unknown relationship type,
or similar error, log a count of how many times each of these errors is
raised.
---------
Signed-off-by: Will Murphy <[email protected]>
from, ok := idMap[id(relationship.Parent)].(artifact.Identifiable)
180
206
if !ok {
181
-
log.Warnf("relationship mapping from key %s is not a valid artifact.Identifiable type: %+v", relationship.Parent, idMap[relationship.Parent])
182
-
return nil
207
+
returnnil,fmt.Errorf("relationship mapping from key %s is not a valid artifact.Identifiable type: %+v", relationship.Parent, idMap[relationship.Parent])
183
208
}
184
209
185
210
to, ok := idMap[id(relationship.Child)].(artifact.Identifiable)
186
211
if !ok {
187
-
log.Warnf("relationship mapping to key %s is not a valid artifact.Identifiable type: %+v", relationship.Child, idMap[relationship.Child])
188
-
return nil
212
+
returnnil,fmt.Errorf("relationship mapping to key %s is not a valid artifact.Identifiable type: %+v", relationship.Child, idMap[relationship.Child])
189
213
}
190
214
191
215
typ := artifact.RelationshipType(relationship.Type)
skipped 2 lines
194
218
case artifact.OwnershipByFileOverlapRelationship, artifact.ContainsRelationship, artifact.DependencyOfRelationship, artifact.EvidentByRelationship:
195
219
default:
196
220
if !strings.Contains(string(typ), "dependency-of") {