blob: 330e8d3110744571daf3d6b2c85c6f3d512d1f93 [file] [log] [blame]
// Copyright 2019 The Goma Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package server
import ""
type remoteSampler struct {
sampler trace.Sampler
func (rs remoteSampler) Sample(p trace.SamplingParameters) trace.SamplingDecision {
if p.HasRemoteParent {
return trace.SamplingDecision{
Sample: true,
return rs.sampler(p)
// NewRemoteSampler returns trace sampler to sample if remote is sampled
// if remoteSampled is true.
// if remoteSampled is false or remote is not sampled, use sampler.
func NewRemoteSampler(remoteSampled bool, sampler trace.Sampler) trace.Sampler {
if remoteSampled {
return remoteSampler{
sampler: sampler,
return sampler