func (p *Processor) Process(root *pb.Span, t pb.Trace) (events []*pb.Span, numExtracted int64) {
	if len(p.extractors) == 0 {
		return
	}

	priority, hasPriority := sampler.GetSamplingPriority(root)
	if !hasPriority {
		priority = sampler.PriorityNone
	}

	clientSampleRate := sampler.GetClientRate(root)
	preSampleRate := sampler.GetPreSampleRate(root)

	for _, span := range t {
		extractionRate, ok := p.extract(span, priority)
		if !ok {
			continue
		}
		if !sampler.SampleByRate(span.TraceID, extractionRate) {
			continue
		}

		numExtracted++

		sampled, epsRate := p.maxEPSSample(span, priority)
		if !sampled {
			continue
		}

		sampler.SetMaxEPSRate(span, epsRate)
		sampler.SetClientRate(span, clientSampleRate)
		sampler.SetPreSampleRate(span, preSampleRate)
		sampler.SetEventExtractionRate(span, extractionRate)
		if hasPriority {
			sampler.SetSamplingPriority(span, priority)
		}

		events = append(events, span)
	}

	return events, numExtracted
}
// Process takes a processed trace, extracts events from it and samples them, returning a collection of
// sampled events along with the total count of extracted events.
Process takes a processed trace, extracts events from it and samples them, returning a collection of
sampled events along with the total count of extracted events.
// Process takes a processed trace extracts events from it and samples them returning a collection of // sampled events along with the total count of extracted events .
func (p *Processor) Process(root *pb.Span, t pb.Trace) (events []*pb.Span, numExtracted int64) {
	if len(p.extractors) == 0 {
		return
	}
	priority, hasPriority := sampler.GetSamplingPriority(root)
	if !hasPriority {
		priority = sampler.PriorityNone
	}
	clientSampleRate := sampler.GetClientRate(root)
	preSampleRate := sampler.GetPreSampleRate(root)
	for _, span := range t {
		extractionRate, ok := p.extract(span, priority)
		if !ok {
			continue
		}
		if !sampler.SampleByRate(span.TraceID, extractionRate) {
			continue
		}
		numExtracted++
		sampled, epsRate := p.maxEPSSample(span, priority)
		if !sampled {
			continue
		}
		sampler.SetMaxEPSRate(span, epsRate)
		sampler.SetClientRate(span, clientSampleRate)
		sampler.SetPreSampleRate(span, preSampleRate)
		sampler.SetEventExtractionRate(span, extractionRate)
		if hasPriority {
			sampler.SetSamplingPriority(span, priority)
		}
		events = append(events, span)
	}
	return events, numExtracted
}
func ( p * Processor ) Process ( root * pb . Span , t pb . Trace ) ( events [ ] * pb . Span , numExtracted int64 ) { if len ( p . extractors ) == 0 { return } priority , hasPriority := sampler . GetSamplingPriority ( root ) if ! hasPriority { priority = sampler . PriorityNone } clientSampleRate := sampler . GetClientRate ( root ) preSampleRate := sampler . GetPreSampleRate ( root ) for _ , span := range t { extractionRate , ok := p . extract ( span , priority ) if ! ok { continue } if ! sampler . SampleByRate ( span . TraceID , extractionRate ) { continue } numExtracted ++ sampled , epsRate := p . maxEPSSample ( span , priority ) if ! sampled { continue } sampler . SetMaxEPSRate ( span , epsRate ) sampler . SetClientRate ( span , clientSampleRate ) sampler . SetPreSampleRate ( span , preSampleRate ) sampler . SetEventExtractionRate ( span , extractionRate ) if hasPriority { sampler . SetSamplingPriority ( span , priority ) } events = append ( events , span ) } return events , numExtracted }
Process takes a processed trace, extracts events from it and samples them, returning a collection of
sampled events along with the total count of extracted events.
Process takes a processed trace extracts events from it and samples them returning a collection of sampled events along with the total count of extracted events .