-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23022 from RoadieHQ/quiter-logs
Make catalog logging a little quieter where entities are erroring
- Loading branch information
Showing
5 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
'@backstage/plugin-catalog-backend': patch | ||
--- | ||
|
||
Make entity collection errors a little quieter in the logs. | ||
|
||
Instead of logging a warning line when an entity has an error | ||
during processing, it will now instead emit an event on the event | ||
broker. | ||
|
||
This only removes a single log line, however it is possible to | ||
add the log line back if it is required by subscribing to the | ||
`CATALOG_ERRORS_TOPIC` as shown below. | ||
|
||
```typescript | ||
env.eventBroker.subscribe({ | ||
supportsEventTopics(): string[] { | ||
return [CATALOG_ERRORS_TOPIC]; | ||
}, | ||
|
||
async onEvent( | ||
params: EventParams<{ | ||
entity: string; | ||
location?: string; | ||
errors: Array<Error>; | ||
}>, | ||
): Promise<void> { | ||
const { entity, location, errors } = params.eventPayload; | ||
for (const error of errors) { | ||
env.logger.warn(error.message, { | ||
entity, | ||
location, | ||
}); | ||
} | ||
}, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters