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

Notification Addition #73

Merged
merged 9 commits into from
Jan 4, 2021
Merged

Notification Addition #73

merged 9 commits into from
Jan 4, 2021

Conversation

mantzas
Copy link
Contributor

@mantzas mantzas commented Dec 30, 2020

Which problem is this PR solving?

Closes #17.

Short description of the changes

  • Introduced notification channel support with new constructor
  • Added examples
  • Updated documentation
  • Migrated to map based table driven tests

@codecov
Copy link

codecov bot commented Dec 30, 2020

Codecov Report

Merging #73 (6793ed9) into master (33868aa) will decrease coverage by 1.96%.
The diff coverage is 84.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
- Coverage   89.93%   87.97%   -1.97%     
==========================================
  Files          11       11              
  Lines         497      524      +27     
==========================================
+ Hits          447      461      +14     
- Misses         30       36       +6     
- Partials       20       27       +7     
Impacted Files Coverage Δ
harvester.go 76.11% <79.59%> (-3.89%) ⬇️
config/config.go 92.50% <100.00%> (+2.50%) ⬆️
config/parser.go 100.00% <100.00%> (ø)
seed/seed.go 90.10% <0.00%> (-7.70%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33868aa...6793ed9. Read the comment docs.

@mantzas mantzas marked this pull request as ready for review December 30, 2020 16:16
Copy link
Contributor

@c0nstantx c0nstantx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition. Just a few comments

config/config.go Outdated
@@ -40,16 +40,18 @@ type Field struct {
version uint64
structField CfgType
sources map[Source]string
chNotify chan<- string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the ability to track changes in configuration is awesome, but I think sending just a string doesn't give too much value.
It would be better to send a notification struct with more information like the previous and next values along with the field (at least its name) so that some kind of calculation can be done from the user.
For example if there is a bigger change than x% or maybe send these values to another service (ex. auditing, event message etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. On it.

addr: addr,
dataCenter: dataCenter,
token: token,
timeout: timeout,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement 🚀

@mantzas mantzas requested a review from c0nstantx December 31, 2020 15:28
@mantzas mantzas merged commit 7f03dbb into master Jan 4, 2021
@mantzas mantzas deleted the add-notification branch January 4, 2021 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose notification every time a change happens in harvester
3 participants