Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Daemon optimizations #802

Merged
merged 5 commits into from
Dec 19, 2018
Merged

Daemon optimizations #802

merged 5 commits into from
Dec 19, 2018

Conversation

palourde
Copy link
Contributor

Description

This PR introduces a couple of changes around the fetcher, in order to optimize the operations and prevent data races:

  • Prevent a data race around the APIs list shuffling
  • Prevent data races when accessing the "snapshot" data of a datacenter
  • Use a RWMutex so the API can request multiple read locks simultaneously
  • Refactoring of the fetcher's goroutines coordination so they can be canceled (bt using a context all the way up to the HTTP client) and and the errors can be sent over a channel instead
  • Make the logs a bit less verbose in the warning level; only log the first error with an API at this level and log the rest as debug

Related Issue

It fixes some issues reported by one of our customer.

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: Simon Plourde <simon.plourde@gmail.com>
Signed-off-by: Simon Plourde <simon.plourde@gmail.com>
Signed-off-by: Simon Plourde <simon.plourde@gmail.com>
Signed-off-by: Simon Plourde <simon.plourde@gmail.com>
Signed-off-by: Simon Plourde <simon.plourde@gmail.com>
@palourde palourde requested a review from amdprophet December 19, 2018 21:05
@codecov-io
Copy link

codecov-io commented Dec 19, 2018

Codecov Report

Merging #802 into master will decrease coverage by 0.54%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #802      +/-   ##
==========================================
- Coverage   21.47%   20.93%   -0.55%     
==========================================
  Files          28       28              
  Lines        2468     2532      +64     
==========================================
  Hits          530      530              
- Misses       1873     1937      +64     
  Partials       65       65
Impacted Files Coverage Δ
uchiwa/server.go 0% <0%> (ø) ⬆️
uchiwa/daemon/helpers.go 22.22% <0%> (ø) ⬆️
uchiwa/daemon/daemon.go 6.29% <0%> (-1.73%) ⬇️
uchiwa/main.go 43.63% <0%> (ø) ⬆️

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 cdb7e90...733178a. Read the comment docs.

@palourde palourde merged commit 4a0a165 into sensu:master Dec 19, 2018
@palourde palourde deleted the daemon-optimization branch December 19, 2018 21:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants