Skip to content

Commit

Permalink
[all] Remove more unused params (open-telemetry#22971)
Browse files Browse the repository at this point in the history
Linked issue: open-telemetry#20424

Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten authored and Caleb-Hurshman committed Jul 6, 2023
1 parent 12c08eb commit f200508
Show file tree
Hide file tree
Showing 38 changed files with 72 additions and 72 deletions.
6 changes: 3 additions & 3 deletions exporter/awsemfexporter/datapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
summaryMetricCalculator = aws.NewMetricCalculator(calculateSummaryDelta)
)

func calculateSummaryDelta(prev *aws.MetricValue, val interface{}, timestampMs time.Time) (interface{}, bool) {
func calculateSummaryDelta(prev *aws.MetricValue, val interface{}, _ time.Time) (interface{}, bool) {
metricEntry := val.(summaryMetricEntry)
summaryDelta := metricEntry.sum
countDelta := metricEntry.count
Expand Down Expand Up @@ -98,7 +98,7 @@ type summaryMetricEntry struct {
}

// CalculateDeltaDatapoints retrieves the NumberDataPoint at the given index and performs rate/delta calculation if necessary.
func (dps numberDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, detailedMetrics bool) ([]dataPoint, bool) {
func (dps numberDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, _ bool) ([]dataPoint, bool) {
metric := dps.NumberDataPointSlice.At(i)
labels := createLabels(metric.Attributes(), instrumentationScopeName)
timestampMs := unixNanoToMilliseconds(metric.Timestamp())
Expand Down Expand Up @@ -138,7 +138,7 @@ func (dps numberDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationS
}

// CalculateDeltaDatapoints retrieves the HistogramDataPoint at the given index.
func (dps histogramDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, detailedMetrics bool) ([]dataPoint, bool) {
func (dps histogramDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, _ bool) ([]dataPoint, bool) {
metric := dps.HistogramDataPointSlice.At(i)
labels := createLabels(metric.Attributes(), instrumentationScopeName)
timestamp := unixNanoToMilliseconds(metric.Timestamp())
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/emf_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (emf *emfExporter) listPushers() []cwlogs.Pusher {
}

// shutdown stops the exporter and is invoked during shutdown.
func (emf *emfExporter) shutdown(ctx context.Context) error {
func (emf *emfExporter) shutdown(_ context.Context) error {
for _, emfPusher := range emf.listPushers() {
returnError := emfPusher.ForceFlush()
if returnError != nil {
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/emf_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type mockPusher struct {
mock.Mock
}

func (p *mockPusher) AddLogEntry(logEvent *cwlogs.Event) error {
func (p *mockPusher) AddLogEntry(_ *cwlogs.Event) error {
args := p.Called(nil)
errorStr := args.String(0)
if errorStr != "" {
Expand Down
6 changes: 3 additions & 3 deletions exporter/azuremonitorexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func createDefaultConfig() component.Config {
}

func (f *factory) createTracesExporter(
ctx context.Context,
_ context.Context,
set exporter.CreateSettings,
cfg component.Config,
) (exporter.Traces, error) {
Expand All @@ -67,7 +67,7 @@ func (f *factory) createTracesExporter(
}

func (f *factory) createLogsExporter(
ctx context.Context,
_ context.Context,
set exporter.CreateSettings,
cfg component.Config,
) (exporter.Logs, error) {
Expand All @@ -82,7 +82,7 @@ func (f *factory) createLogsExporter(
}

func (f *factory) createMetricsExporter(
ctx context.Context,
_ context.Context,
set exporter.CreateSettings,
cfg component.Config,
) (exporter.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/logexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type logExporter struct {
logger *zap.Logger
}

func (exporter *logExporter) onLogData(context context.Context, logData plog.Logs) error {
func (exporter *logExporter) onLogData(_ context.Context, logData plog.Logs) error {
resourceLogs := logData.ResourceLogs()
logPacker := newLogPacker(exporter.logger)

Expand Down
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/metricexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type metricExporter struct {
packer *metricPacker
}

func (exporter *metricExporter) onMetricData(context context.Context, metricData pmetric.Metrics) error {
func (exporter *metricExporter) onMetricData(_ context.Context, metricData pmetric.Metrics) error {
resourceMetrics := metricData.ResourceMetrics()

for i := 0; i < resourceMetrics.Len(); i++ {
Expand Down
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/traceexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (v *traceVisitor) visit(
return true
}

func (exporter *traceExporter) onTraceData(context context.Context, traceData ptrace.Traces) error {
func (exporter *traceExporter) onTraceData(_ context.Context, traceData ptrace.Traces) error {
spanCount := traceData.SpanCount()
if spanCount == 0 {
return nil
Expand Down
6 changes: 3 additions & 3 deletions exporter/clickhouseexporter/exporter_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ type testClickhouseDriver struct {
recorder recorder
}

func (t *testClickhouseDriver) Open(name string) (driver.Conn, error) {
func (t *testClickhouseDriver) Open(_ string) (driver.Conn, error) {
return &testClickhouseDriverConn{
recorder: t.recorder,
}, nil
Expand All @@ -169,7 +169,7 @@ func (*testClickhouseDriverConn) Begin() (driver.Tx, error) {
return &testClickhouseDriverTx{}, nil
}

func (*testClickhouseDriverConn) CheckNamedValue(v *driver.NamedValue) error {
func (*testClickhouseDriverConn) CheckNamedValue(_ *driver.NamedValue) error {
return nil
}

Expand All @@ -190,7 +190,7 @@ func (t *testClickhouseDriverStmt) Exec(args []driver.Value) (driver.Result, err
return nil, t.recorder(t.query, args)
}

func (t *testClickhouseDriverStmt) Query(args []driver.Value) (driver.Rows, error) {
func (t *testClickhouseDriverStmt) Query(_ []driver.Value) (driver.Rows, error) {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/clickhouseexporter/exporter_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (e *metricsExporter) start(ctx context.Context, _ component.Host) error {
}

// shutdown will shut down the exporter.
func (e *metricsExporter) shutdown(ctx context.Context) error {
func (e *metricsExporter) shutdown(_ context.Context) error {
if e.client != nil {
return e.client.Close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func GetHostInfo(logger *zap.Logger) (hostInfo *HostInfo) {
return
}

func (hi *HostInfo) GetHostname(logger *zap.Logger) string {
func (hi *HostInfo) GetHostname(_ *zap.Logger) string {
if isDefaultHostname(hi.EC2Hostname) {
return hi.InstanceID
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func (p *Provider) fillHostInfo() {
p.once.Do(func() { p.hostInfo = *GetHostInfo(p.logger) })
}

func (p *Provider) Source(ctx context.Context) (source.Source, error) {
func (p *Provider) Source(_ context.Context) (source.Source, error) {
p.fillHostInfo()
if p.hostInfo.InstanceID == "" {
return source.Source{}, fmt.Errorf("instance ID is unavailable")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Provider struct {
}

// OnECSFargate determines if the application is running on ECS Fargate.
func (p *Provider) OnECSFargate(ctx context.Context) (bool, error) {
func (p *Provider) OnECSFargate(_ context.Context) (bool, error) {
if p.missingEndpoint {
// No ECS metadata endpoint, therefore not on ECS Fargate
return false, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (p *Provider) Source(context.Context) (source.Source, error) {
return source.Source{Kind: source.HostnameKind, Identifier: fmt.Sprintf("%s.%s", name, cloudAccount)}, nil
}

func (p *Provider) ClusterName(ctx context.Context) (string, error) {
func (p *Provider) ClusterName(_ context.Context) (string, error) {
return p.detector.GKEClusterName()
}

Expand Down
12 changes: 6 additions & 6 deletions exporter/datadogexporter/internal/testutil/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type validateAPIKeyResponse struct {
Valid bool `json:"valid"`
}

func validateAPIKeyEndpoint(w http.ResponseWriter, r *http.Request) {
func validateAPIKeyEndpoint(w http.ResponseWriter, _ *http.Request) {
res := validateAPIKeyResponse{Valid: true}
resJSON, _ := json.Marshal(res)

Expand All @@ -108,7 +108,7 @@ func validateAPIKeyEndpoint(w http.ResponseWriter, r *http.Request) {
}
}

func validateAPIKeyEndpointInvalid(w http.ResponseWriter, r *http.Request) {
func validateAPIKeyEndpointInvalid(w http.ResponseWriter, _ *http.Request) {
res := validateAPIKeyResponse{Valid: false}
resJSON, _ := json.Marshal(res)

Expand All @@ -123,7 +123,7 @@ type metricsResponse struct {
Status string `json:"status"`
}

func metricsEndpoint(w http.ResponseWriter, r *http.Request) {
func metricsEndpoint(w http.ResponseWriter, _ *http.Request) {
res := metricsResponse{Status: "ok"}
resJSON, _ := json.Marshal(res)

Expand All @@ -135,7 +135,7 @@ func metricsEndpoint(w http.ResponseWriter, r *http.Request) {
}
}

func metricsV2Endpoint(w http.ResponseWriter, r *http.Request) {
func metricsV2Endpoint(w http.ResponseWriter, _ *http.Request) {
res := metricsResponse{Status: "ok"}
resJSON, _ := json.Marshal(res)

Expand Down Expand Up @@ -218,15 +218,15 @@ type MockSourceProvider struct {
Src source.Source
}

func (s *MockSourceProvider) Source(ctx context.Context) (source.Source, error) {
func (s *MockSourceProvider) Source(_ context.Context) (source.Source, error) {
return s.Src, nil
}

type MockStatsProcessor struct {
In []pb.ClientStatsPayload
}

func (s *MockStatsProcessor) ProcessStats(in pb.ClientStatsPayload, lang, tracerVersion string) {
func (s *MockStatsProcessor) ProcessStats(in pb.ClientStatsPayload, _, _ string) {
s.In = append(s.In, in)
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/logs_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func newLogsExporter(ctx context.Context, params exporter.CreateSettings, cfg *C
var _ consumer.ConsumeLogsFunc = (*logsExporter)(nil).consumeLogs

// consumeLogs is implementation of cosumer.ConsumeLogsFunc
func (exp *logsExporter) consumeLogs(ctx context.Context, ld plog.Logs) (err error) {
func (exp *logsExporter) consumeLogs(_ context.Context, ld plog.Logs) (err error) {
defer func() { err = exp.scrubber.Scrub(err) }()
if exp.cfg.HostMetadata.Enabled {
// start host metadata with resource attributes from
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/traces_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ func TestMain(m *testing.M) {
type testlogger struct{}

// Trace implements Logger.
func (testlogger) Trace(v ...interface{}) {}
func (testlogger) Trace(_ ...interface{}) {}

// Tracef implements Logger.
func (testlogger) Tracef(format string, params ...interface{}) {}
func (testlogger) Tracef(_ string, _ ...interface{}) {}

// Debug implements Logger.
func (testlogger) Debug(v ...interface{}) { fmt.Println("DEBUG", fmt.Sprint(v...)) }
Expand Down
2 changes: 1 addition & 1 deletion exporter/pulsarexporter/jaeger_marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type jaegerMarshaler struct {

var _ TracesMarshaler = (*jaegerMarshaler)(nil)

func (j jaegerMarshaler) Marshal(traces ptrace.Traces, topic string) ([]*pulsar.ProducerMessage, error) {
func (j jaegerMarshaler) Marshal(traces ptrace.Traces, _ string) ([]*pulsar.ProducerMessage, error) {
batches, err := jaeger.ProtoFromTraces(traces)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions exporter/pulsarexporter/pdata_marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type pdataLogsMarshaler struct {
encoding string
}

func (p pdataLogsMarshaler) Marshal(ld plog.Logs, topic string) ([]*pulsar.ProducerMessage, error) {
func (p pdataLogsMarshaler) Marshal(ld plog.Logs, _ string) ([]*pulsar.ProducerMessage, error) {
bts, err := p.marshaler.MarshalLogs(ld)
if err != nil {
return nil, err
Expand Down Expand Up @@ -43,7 +43,7 @@ type pdataMetricsMarshaler struct {
encoding string
}

func (p pdataMetricsMarshaler) Marshal(ld pmetric.Metrics, topic string) ([]*pulsar.ProducerMessage, error) {
func (p pdataMetricsMarshaler) Marshal(ld pmetric.Metrics, _ string) ([]*pulsar.ProducerMessage, error) {
bts, err := p.marshaler.MarshalMetrics(ld)
if err != nil {
return nil, err
Expand Down Expand Up @@ -71,7 +71,7 @@ type pdataTracesMarshaler struct {
encoding string
}

func (p pdataTracesMarshaler) Marshal(td ptrace.Traces, topic string) ([]*pulsar.ProducerMessage, error) {
func (p pdataTracesMarshaler) Marshal(td ptrace.Traces, _ string) ([]*pulsar.ProducerMessage, error) {
bts, err := p.marshaler.MarshalTraces(td)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion exporter/signalfxexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (se *signalfxExporter) pushLogs(ctx context.Context, ld plog.Logs) error {
return err
}

func (se *signalfxExporter) shutdown(ctx context.Context) error {
func (se *signalfxExporter) shutdown(_ context.Context) error {
if se.cancelFn != nil {
se.cancelFn()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

package hostmetadata // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter/internal/hostmetadata"

func fillPlatformSpecificOSData(info *hostOS) error {
func fillPlatformSpecificOSData(_ *hostOS) error {
return nil
}

func fillPlatformSpecificCPUData(info *hostCPU) error {
func fillPlatformSpecificCPUData(_ *hostCPU) error {
return nil
}
2 changes: 1 addition & 1 deletion exporter/tencentcloudlogserviceexporter/logs_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type logServiceLogsSender struct {
}

func (s *logServiceLogsSender) pushLogsData(
ctx context.Context,
_ context.Context,
md plog.Logs) error {
var err error
clsLogs := convertLogs(md)
Expand Down
2 changes: 1 addition & 1 deletion extension/awsproxy/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type xrayProxy struct {

var _ extension.Extension = (*xrayProxy)(nil)

func (x xrayProxy) Start(ctx context.Context, host component.Host) error {
func (x xrayProxy) Start(_ context.Context, host component.Host) error {
go func() {
if err := x.server.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) && err != nil {
host.ReportFatalError(err)
Expand Down
2 changes: 1 addition & 1 deletion extension/basicauthextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func newServerAuthExtension(cfg *Config) (auth.Server, error) {
), nil
}

func (ba *basicAuth) serverStart(ctx context.Context, host component.Host) error {
func (ba *basicAuth) serverStart(_ context.Context, _ component.Host) error {
var rs []io.Reader

if ba.htpasswd.File != "" {
Expand Down
2 changes: 1 addition & 1 deletion processor/datadogprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func newProcessor(ctx context.Context, logger *zap.Logger, config component.Conf
}

// Start implements the component.Component interface.
func (p *datadogProcessor) Start(ctx context.Context, host component.Host) error {
func (p *datadogProcessor) Start(_ context.Context, host component.Host) error {
var datadogs []exporter.Metrics
loop:
for k, exp := range host.GetExporters()[component.DataTypeMetrics] {
Expand Down
4 changes: 2 additions & 2 deletions processor/datadogprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ type mockHost struct {
Exporters map[component.DataType]map[component.ID]component.Component
}

func (m *mockHost) ReportFatalError(err error) {}
func (m *mockHost) ReportFatalError(_ error) {}

func (m *mockHost) GetFactory(kind component.Kind, componentType component.Type) component.Factory {
func (m *mockHost) GetFactory(_ component.Kind, _ component.Type) component.Factory {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion processor/logstransformprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func createDefaultConfig() component.Config {
}

func createLogsProcessor(
ctx context.Context,
_ context.Context,
set processor.CreateSettings,
cfg component.Config,
nextConsumer consumer.Logs) (processor.Logs, error) {
Expand Down
6 changes: 3 additions & 3 deletions processor/logstransformprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (ltp *logsTransformProcessor) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: true}
}

func (ltp *logsTransformProcessor) Shutdown(ctx context.Context) error {
func (ltp *logsTransformProcessor) Shutdown(_ context.Context) error {
ltp.logger.Info("Stopping logs transform processor")
pipelineErr := ltp.pipe.Stop()
ltp.converter.Stop()
Expand All @@ -72,7 +72,7 @@ func (ltp *logsTransformProcessor) Shutdown(ctx context.Context) error {
return pipelineErr
}

func (ltp *logsTransformProcessor) Start(ctx context.Context, host component.Host) error {
func (ltp *logsTransformProcessor) Start(ctx context.Context, _ component.Host) error {

// There is no need for this processor to use storage
err := ltp.pipe.Start(storage.NewNopClient())
Expand Down Expand Up @@ -116,7 +116,7 @@ func (ltp *logsTransformProcessor) Start(ctx context.Context, host component.Hos
return nil
}

func (ltp *logsTransformProcessor) ConsumeLogs(ctx context.Context, ld plog.Logs) error {
func (ltp *logsTransformProcessor) ConsumeLogs(_ context.Context, ld plog.Logs) error {
// Add the logs to the chain
return ltp.fromConverter.Batch(ld)
}
Expand Down

0 comments on commit f200508

Please sign in to comment.