Skip to content

Commit

Permalink
OCPBUGS-45047: Avoid to send the same error repeated N times (#1043)
Browse files Browse the repository at this point in the history
* Avoid to send the same error repeated N times

* Fix the LokiStack gatherer documentation
  • Loading branch information
joselsegura committed Dec 5, 2024
1 parent b0396fd commit 49cf02e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions docs/gathered-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,15 +1066,15 @@ None

Collects `lokistacks.loki.grafana.com` resources.

The gatherer will collect up to 20 resources from `openshift-logging` namespace
The gatherer will collect up to 20 resources from `openshift-*` namespaces
and it will report errors if it finds a `LokiStack` resource in a different namespace
or if there are more than 20 `LokiStacks` in the `openshift-logging` namespace.
or if there are more than 20 `LokiStacks` in the `openshift-*` namespaces.

### API Reference
None

### Sample data
- [docs/insights-archive-sample/namespaces/openshift-logging/.json](./insights-archive-sample/namespaces/openshift-logging/.json)
- [docs/insights-archive-sample/namespaces/openshift-logging/lokistack-sample.json](./insights-archive-sample/namespaces/openshift-logging/lokistack-sample.json)

### Location in archive
- `namespace/{namespace}/loki.grafana.com/lokistacks/{name}.json`
Expand All @@ -1083,7 +1083,7 @@ None
`clusterconfig/lokistacks

### Released version
- 4.18.0
- 4.19.0

### Backported versions
None
Expand Down Expand Up @@ -2365,5 +2365,6 @@ None

### Changes
- Image repository is now collected if it comes from outside the Red Hat domain
- [Tech Preview] runtime info for workloads are collected (since 4.18.0)


11 changes: 6 additions & 5 deletions pkg/gatherers/clusterconfig/gather_lokistack.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ const lokiStackResourceLimit = 20

// GatherLokiStack Collects `lokistacks.loki.grafana.com` resources.
//
// The gatherer will collect up to 20 resources from `openshift-logging` namespace
// The gatherer will collect up to 20 resources from `openshift-*` namespaces
// and it will report errors if it finds a `LokiStack` resource in a different namespace
// or if there are more than 20 `LokiStacks` in the `openshift-logging` namespace.
// or if there are more than 20 `LokiStacks` in the `openshift-*` namespaces.
//
// ### API Reference
// None
//
// ### Sample data
// - docs/insights-archive-sample/namespaces/openshift-logging/.json
// - docs/insights-archive-sample/namespaces/openshift-logging/lokistack-sample.json
//
// ### Location in archive
// - `namespace/openshift-logging/loki.grafana.com/lokistacks/{name}.json`
// - `namespace/{namespace}/loki.grafana.com/lokistacks/{name}.json`
//
// ### Config ID
// `clusterconfig/lokistacks
//
// ### Released version
// - 4.18.0
// - 4.19.0
//
// ### Backported versions
// None
Expand Down Expand Up @@ -87,6 +87,7 @@ func gatherLokiStack(ctx context.Context, dynamicClient dynamic.Interface) ([]re

if len(records) >= lokiStackResourceLimit {
if !tooManyResourcesError {
tooManyResourcesError = true
errs = append(errs, fmt.Errorf(
"found %d resources, limit (%d) reached",
len(loggingResourceList.Items), lokiStackResourceLimit),
Expand Down

0 comments on commit 49cf02e

Please sign in to comment.