Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Quick patch to fix panic, more analysis pending (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored Mar 13, 2017
1 parent c16461d commit abf8705
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ func (s *RemotelyControlledSampler) updateSampler() {
if res, err := s.manager.GetSamplingStrategy(s.serviceName); err == nil {
if sampler, strategies, err := s.extractSampler(res); err == nil {
s.metrics.SamplerRetrieved.Inc(1)
// NB: adaptive sampler always returns false from Equal()
if !s.sampler.Equal(sampler) {
s.lockAndUpdateSampler(sampler, strategies)
}
Expand All @@ -510,7 +511,7 @@ func (s *RemotelyControlledSampler) lockAndUpdateSampler(
) {
s.Lock()
defer s.Unlock()
if adaptiveSampler, ok := s.sampler.(*adaptiveSampler); ok {
if adaptiveSampler, ok := s.sampler.(*adaptiveSampler); ok && strategies != nil {
if err := adaptiveSampler.update(strategies); err != nil {
s.metrics.SamplerUpdateFailure.Inc(1)
return
Expand Down

0 comments on commit abf8705

Please sign in to comment.