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

Quick patch to fix panic, more analysis pending #111

Merged
merged 1 commit into from
Mar 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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