Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrich notification-publisher logs with context #770

Merged
merged 3 commits into from
Aug 29, 2023
Merged

Enrich notification-publisher logs with context #770

merged 3 commits into from
Aug 29, 2023

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Aug 28, 2023

Logs emitted by the notification-publisher will now include additional context about the notification record that's being processed, as well as the applicable notification rule being handled.

Additionally, both SendMailPublisher, as well as all implementations of AbstractWebhookPublisher will now emit a log message when notifications were published successfully to the configured destination.

Example log output for the WebhookPublisher:

2023-08-28 15:47:48,326 INFO  [org.hya.not.pub.WebhookPublisher] (pc-pool-5-thread-2) Destination http://localhost:34025/foo acknowledged reception of notification with status code 204 (PublishContext{kafkaTopic=dtrack.notification.new-vulnerability, kafkaTopicPartition=0, kafkaPartitionOffset=0, notificationGroup=GROUP_NEW_VULNERABILITY, notificationLevel=LEVEL_INFORMATIONAL, notificationScope=SCOPE_PORTFOLIO, notificationTimestamp=1970-01-01T00:11:06Z, notificationSubjects={component=Component[uuid=componentUuid, group=componentGroup, name=componentName, version=componentVersion], project=Project[uuid=projectUuid, name=projectName, version=projectVersion]}, ruleName=foo, ruleScope=PORTFOLIO, ruleLevel=INFORMATIONAL})

Note
The notificationSubjects field in the context object is intended to give a a surface-level overview of what entity the notification is about. The goal is to be able to quickly correlate notifications with projects, or components within those projects.

Closes #768

…cation-publisher

Both the `SendMailPublisher` and *all* `WebhookPublisher`s now log a message with level `INFO`, whenever a notification was sent successfully.

Closes #768

Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added enhancement New feature or request domain/notifications labels Aug 28, 2023
Signed-off-by: nscuro <nscuro@protonmail.com>
@sonarcloud
Copy link

sonarcloud bot commented Aug 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

82.5% 82.5% Coverage
0.0% 0.0% Duplication

@nscuro nscuro merged commit 01219ad into main Aug 29, 2023
12 checks passed
@nscuro nscuro deleted the issue-768 branch August 29, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit log message when notification was published successfully
2 participants