Retain all diagnostic groups without capacity caps
This commit is contained in:
@@ -12,7 +12,6 @@ const (
|
||||
MaxDiagnosticScopeBytes = 512
|
||||
MaxDiagnosticMessageBytes = 4 * 1024
|
||||
MaxDiagnosticSamples = 3
|
||||
MaxProducerDiagnosticGroups = 64
|
||||
)
|
||||
|
||||
// DiagnosticDisposition identifies the operator significance of a producer
|
||||
@@ -97,9 +96,7 @@ type DiagnosticGroup struct {
|
||||
// and presentation boundaries. Global aggregation policy is applied by the
|
||||
// framework before it reaches those boundaries.
|
||||
type DiagnosticCollection struct {
|
||||
Groups []DiagnosticGroup `json:"groups"`
|
||||
Truncated bool `json:"truncated"`
|
||||
UnrepresentedOccurrenceCount int `json:"unrepresented_occurrence_count"`
|
||||
Groups []DiagnosticGroup `json:"groups"`
|
||||
}
|
||||
|
||||
// DiagnosticProjection is the validated warning/non-warning view used by
|
||||
@@ -129,9 +126,6 @@ func (diagnostic ProducerDiagnostic) Validate() error {
|
||||
// ValidateProducerDiagnostics validates the complete set returned by one
|
||||
// producer or validator result.
|
||||
func ValidateProducerDiagnostics(diagnostics []ProducerDiagnostic) error {
|
||||
if len(diagnostics) > MaxProducerDiagnosticGroups {
|
||||
return errors.New("producer diagnostics exceed maximum group count")
|
||||
}
|
||||
for index, diagnostic := range diagnostics {
|
||||
if err := diagnostic.Validate(); err != nil {
|
||||
return fmt.Errorf("producer diagnostic %d: %w", index, err)
|
||||
@@ -179,15 +173,8 @@ func (group DiagnosticGroup) Validate() error {
|
||||
)
|
||||
}
|
||||
|
||||
// Validate checks the collection shape without imposing later global
|
||||
// aggregation limits.
|
||||
// Validate checks the collection shape and group identities.
|
||||
func (collection DiagnosticCollection) Validate() error {
|
||||
if collection.UnrepresentedOccurrenceCount < 0 {
|
||||
return errors.New("diagnostic collection unrepresented occurrence count must not be negative")
|
||||
}
|
||||
if !collection.Truncated && collection.UnrepresentedOccurrenceCount != 0 {
|
||||
return errors.New("diagnostic collection has unrepresented occurrences without truncation")
|
||||
}
|
||||
seen := make(map[diagnosticGroupKey]struct{}, len(collection.Groups))
|
||||
for index, group := range collection.Groups {
|
||||
if err := group.Validate(); err != nil {
|
||||
@@ -203,7 +190,7 @@ func (collection DiagnosticCollection) Validate() error {
|
||||
}
|
||||
|
||||
// ProjectDiagnosticCollection validates, partitions, and totals one finalized
|
||||
// collection. Unrepresented occurrences belong to the non-warning projection.
|
||||
// collection.
|
||||
func ProjectDiagnosticCollection(collection DiagnosticCollection) (DiagnosticProjection, error) {
|
||||
if err := collection.Validate(); err != nil {
|
||||
return DiagnosticProjection{}, err
|
||||
@@ -229,11 +216,6 @@ func ProjectDiagnosticCollection(collection DiagnosticCollection) (DiagnosticPro
|
||||
projection.DiagnosticOccurrenceCount = count
|
||||
projection.Diagnostics = append(projection.Diagnostics, cloneDiagnosticGroup(group))
|
||||
}
|
||||
count, err := addDiagnosticOccurrences(projection.DiagnosticOccurrenceCount, collection.UnrepresentedOccurrenceCount)
|
||||
if err != nil {
|
||||
return DiagnosticProjection{}, fmt.Errorf("diagnostic occurrences: %w", err)
|
||||
}
|
||||
projection.DiagnosticOccurrenceCount = count
|
||||
return projection, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user