Skip to content

Commit

Permalink
Fix process to enable unparam (#1505)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Aug 5, 2020
1 parent 8b55cb6 commit 686d45b
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 38 deletions.
10 changes: 5 additions & 5 deletions processor/processortest/nop_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (np *nopProcessor) GetCapabilities() component.ProcessorCapabilities {
}

// Start is invoked during service startup.
func (np *nopProcessor) Start(ctx context.Context, host component.Host) error {
func (np *nopProcessor) Start(context.Context, component.Host) error {
return nil
}

Expand Down Expand Up @@ -83,9 +83,9 @@ func (npf *NopProcessorFactory) CreateDefaultConfig() configmodels.Processor {
// If the processor type does not support tracing or if the config is not valid
// error will be returned instead.
func (npf *NopProcessorFactory) CreateTraceProcessor(
logger *zap.Logger,
_ *zap.Logger,
nextConsumer consumer.TraceConsumerOld,
cfg configmodels.Processor,
_ configmodels.Processor,
) (component.TraceProcessorOld, error) {
return &nopProcessor{nextTraceProcessor: nextConsumer}, nil
}
Expand All @@ -94,9 +94,9 @@ func (npf *NopProcessorFactory) CreateTraceProcessor(
// If the processor type does not support metrics or if the config is not valid
// error will be returned instead.
func (npf *NopProcessorFactory) CreateMetricsProcessor(
logger *zap.Logger,
_ *zap.Logger,
nextConsumer consumer.MetricsConsumerOld,
cfg configmodels.Processor,
_ configmodels.Processor,
) (component.MetricsProcessorOld, error) {
return &nopProcessor{nextMetricsProcessor: nextConsumer}, nil
}
4 changes: 2 additions & 2 deletions processor/resourceprocessor/resource_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ type testTraceConsumer struct {
td pdata.Traces
}

func (ttn *testTraceConsumer) ConsumeTraces(ctx context.Context, td pdata.Traces) error {
func (ttn *testTraceConsumer) ConsumeTraces(_ context.Context, td pdata.Traces) error {
// sort attributes to be able to compare traces
for i := 0; i < td.ResourceSpans().Len(); i++ {
sortResourceAttributes(td.ResourceSpans().At(i).Resource())
Expand All @@ -176,7 +176,7 @@ type testMetricsConsumer struct {
md pdata.Metrics
}

func (tmn *testMetricsConsumer) ConsumeMetrics(ctx context.Context, md pdata.Metrics) error {
func (tmn *testMetricsConsumer) ConsumeMetrics(_ context.Context, md pdata.Metrics) error {
// sort attributes to be able to compare traces
imd := pdatautil.MetricsToInternalMetrics(md)
for i := 0; i < imd.ResourceMetrics().Len(); i++ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (f *Factory) CreateDefaultConfig() configmodels.Processor {

// CreateTraceProcessor creates a trace processor based on this config.
func (f *Factory) CreateTraceProcessor(
logger *zap.Logger,
_ *zap.Logger,
nextConsumer consumer.TraceConsumerOld,
cfg configmodels.Processor,
) (component.TraceProcessorOld, error) {
Expand All @@ -58,10 +58,6 @@ func (f *Factory) CreateTraceProcessor(
}

// CreateMetricsProcessor creates a metrics processor based on this config.
func (f *Factory) CreateMetricsProcessor(
logger *zap.Logger,
nextConsumer consumer.MetricsConsumerOld,
cfg configmodels.Processor,
) (component.MetricsProcessorOld, error) {
func (f *Factory) CreateMetricsProcessor(*zap.Logger, consumer.MetricsConsumerOld, configmodels.Processor) (component.MetricsProcessorOld, error) {
return nil, configerror.ErrDataTypeIsNotSupported
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (tsp *tracesamplerprocessor) GetCapabilities() component.ProcessorCapabilit
}

// Start is invoked during service startup.
func (tsp *tracesamplerprocessor) Start(ctx context.Context, host component.Host) error {
func (tsp *tracesamplerprocessor) Start(context.Context, component.Host) error {
return nil
}

Expand Down
6 changes: 1 addition & 5 deletions processor/samplingprocessor/tailsamplingprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ func (f *Factory) CreateTraceProcessor(
}

// CreateMetricsProcessor creates a metrics processor based on this config.
func (f *Factory) CreateMetricsProcessor(
logger *zap.Logger,
nextConsumer consumer.MetricsConsumerOld,
cfg configmodels.Processor,
) (component.MetricsProcessorOld, error) {
func (f *Factory) CreateMetricsProcessor(*zap.Logger, consumer.MetricsConsumerOld, configmodels.Processor) (component.MetricsProcessorOld, error) {
return nil, configerror.ErrDataTypeIsNotSupported
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (tsp *tailSamplingSpanProcessor) samplingPolicyOnTick() {
}

// ConsumeTraceData is required by the SpanProcessor interface.
func (tsp *tailSamplingSpanProcessor) ConsumeTraceData(ctx context.Context, td consumerdata.TraceData) error {
func (tsp *tailSamplingSpanProcessor) ConsumeTraceData(_ context.Context, td consumerdata.TraceData) error {
tsp.start.Do(func() {
tsp.logger.Info("First trace data arrived, starting tail_sampling timers")
tsp.policyTicker.Start(1 * time.Second)
Expand Down Expand Up @@ -314,7 +314,7 @@ func (tsp *tailSamplingSpanProcessor) GetCapabilities() component.ProcessorCapab
}

// Start is invoked during service startup.
func (tsp *tailSamplingSpanProcessor) Start(ctx context.Context, host component.Host) error {
func (tsp *tailSamplingSpanProcessor) Start(context.Context, component.Host) error {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ type mockPolicyEvaluator struct {

var _ sampling.PolicyEvaluator = (*mockPolicyEvaluator)(nil)

func (m *mockPolicyEvaluator) OnLateArrivingSpans(earlyDecision sampling.Decision, spans []*tracepb.Span) error {
func (m *mockPolicyEvaluator) OnLateArrivingSpans(sampling.Decision, []*tracepb.Span) error {
m.LateArrivingSpansCount++
return m.NextError
}
func (m *mockPolicyEvaluator) Evaluate(traceID []byte, trace *sampling.TraceData) (sampling.Decision, error) {
func (m *mockPolicyEvaluator) Evaluate([]byte, *sampling.TraceData) (sampling.Decision, error) {
m.EvaluationCount++
return m.NextDecision, m.NextError
}
func (m *mockPolicyEvaluator) OnDroppedSpans(traceID []byte, trace *sampling.TraceData) (sampling.Decision, error) {
func (m *mockPolicyEvaluator) OnDroppedSpans([]byte, *sampling.TraceData) (sampling.Decision, error) {
m.OnDroppedSpansCount++
return m.NextDecision, m.NextError
}
Expand All @@ -264,7 +264,7 @@ type manualTTicker struct {

var _ tTicker = (*manualTTicker)(nil)

func (t *manualTTicker) Start(d time.Duration) {
func (t *manualTTicker) Start(time.Duration) {
t.Started = true
}

Expand Down Expand Up @@ -314,7 +314,7 @@ type mockSpanProcessor struct {
TotalSpans int
}

func (p *mockSpanProcessor) ConsumeTraceData(ctx context.Context, td consumerdata.TraceData) error {
func (p *mockSpanProcessor) ConsumeTraceData(_ context.Context, td consumerdata.TraceData) error {
p.TotalSpans += len(td.Spans)
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ func NewAlwaysSample(logger *zap.Logger) PolicyEvaluator {
// after the sampling decision was already taken for the trace.
// This gives the evaluator a chance to log any message/metrics and/or update any
// related internal state.
func (as *alwaysSample) OnLateArrivingSpans(earlyDecision Decision, spans []*tracepb.Span) error {
func (as *alwaysSample) OnLateArrivingSpans(Decision, []*tracepb.Span) error {
as.logger.Debug("Triggering action for late arriving spans in always-sample filter")
return nil
}

// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
func (as *alwaysSample) Evaluate(traceID []byte, trace *TraceData) (Decision, error) {
func (as *alwaysSample) Evaluate([]byte, *TraceData) (Decision, error) {
as.logger.Debug("Evaluating spans in always-sample filter")
return Sampled, nil
}

// OnDroppedSpans is called when the trace needs to be dropped, due to memory
// pressure, before the decision_wait time has been reached.
func (as *alwaysSample) OnDroppedSpans(traceID []byte, trace *TraceData) (Decision, error) {
func (as *alwaysSample) OnDroppedSpans([]byte, *TraceData) (Decision, error) {
as.logger.Debug("Triggering action for dropped spans in always-sample filter")
return Sampled, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func NewNumericAttributeFilter(logger *zap.Logger, key string, minValue, maxValu
// after the sampling decision was already taken for the trace.
// This gives the evaluator a chance to log any message/metrics and/or update any
// related internal state.
func (naf *numericAttributeFilter) OnLateArrivingSpans(earlyDecision Decision, spans []*tracepb.Span) error {
func (naf *numericAttributeFilter) OnLateArrivingSpans(Decision, []*tracepb.Span) error {
naf.logger.Debug("Triggering action for late arriving spans in numeric-attribute filter")
return nil
}

// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
func (naf *numericAttributeFilter) Evaluate(traceID []byte, trace *TraceData) (Decision, error) {
func (naf *numericAttributeFilter) Evaluate(_ []byte, trace *TraceData) (Decision, error) {
naf.logger.Debug("Evaluating spans in numeric-attribute filter")
trace.Lock()
batches := trace.ReceivedBatches
Expand All @@ -72,7 +72,7 @@ func (naf *numericAttributeFilter) Evaluate(traceID []byte, trace *TraceData) (D

// OnDroppedSpans is called when the trace needs to be dropped, due to memory
// pressure, before the decision_wait time has been reached.
func (naf *numericAttributeFilter) OnDroppedSpans(traceID []byte, trace *TraceData) (Decision, error) {
func (naf *numericAttributeFilter) OnDroppedSpans([]byte, *TraceData) (Decision, error) {
naf.logger.Debug("Triggering action for dropped spans in numeric-attribute filter")
return NotSampled, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func NewRateLimiting(logger *zap.Logger, spansPerSecond int64) PolicyEvaluator {
// after the sampling decision was already taken for the trace.
// This gives the evaluator a chance to log any message/metrics and/or update any
// related internal state.
func (r *rateLimiting) OnLateArrivingSpans(earlyDecision Decision, spans []*tracepb.Span) error {
func (r *rateLimiting) OnLateArrivingSpans(Decision, []*tracepb.Span) error {
r.logger.Debug("Triggering action for late arriving spans in rate-limiting filter")
return nil
}

// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
func (r *rateLimiting) Evaluate(traceID []byte, trace *TraceData) (Decision, error) {
func (r *rateLimiting) Evaluate(_ []byte, trace *TraceData) (Decision, error) {
r.logger.Debug("Evaluating spans in rate-limiting filter")
currSecond := time.Now().Unix()
if r.currentSecond != currSecond {
Expand All @@ -67,7 +67,7 @@ func (r *rateLimiting) Evaluate(traceID []byte, trace *TraceData) (Decision, err

// OnDroppedSpans is called when the trace needs to be dropped, due to memory
// pressure, before the decision_wait time has been reached.
func (r *rateLimiting) OnDroppedSpans(traceID []byte, trace *TraceData) (Decision, error) {
func (r *rateLimiting) OnDroppedSpans([]byte, *TraceData) (Decision, error) {
r.logger.Debug("Triggering action for dropped spans in rate-limiting filter")
return Sampled, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ func NewStringAttributeFilter(logger *zap.Logger, key string, values []string) P
// after the sampling decision was already taken for the trace.
// This gives the evaluator a chance to log any message/metrics and/or update any
// related internal state.
func (saf *stringAttributeFilter) OnLateArrivingSpans(earlyDecision Decision, spans []*tracepb.Span) error {
func (saf *stringAttributeFilter) OnLateArrivingSpans(Decision, []*tracepb.Span) error {
saf.logger.Debug("Triggering action for late arriving spans in string-tag filter")
return nil
}

// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
func (saf *stringAttributeFilter) Evaluate(traceID []byte, trace *TraceData) (Decision, error) {
func (saf *stringAttributeFilter) Evaluate(_ []byte, trace *TraceData) (Decision, error) {
saf.logger.Debug("Evaluting spans in string-tag filter")
trace.Lock()
batches := trace.ReceivedBatches
Expand Down Expand Up @@ -87,7 +87,7 @@ func (saf *stringAttributeFilter) Evaluate(traceID []byte, trace *TraceData) (De

// OnDroppedSpans is called when the trace needs to be dropped, due to memory
// pressure, before the decision_wait time has been reached.
func (saf *stringAttributeFilter) OnDroppedSpans(traceID []byte, trace *TraceData) (Decision, error) {
func (saf *stringAttributeFilter) OnDroppedSpans([]byte, *TraceData) (Decision, error) {
saf.logger.Debug("Triggering action for dropped spans in string-tag filter")
return NotSampled, nil
}

0 comments on commit 686d45b

Please sign in to comment.