Skip to content

Commit

Permalink
Rename Push functions to be consistent across signals in exporterhelper
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Nov 23, 2020
1 parent cc0a999 commit 6adb673
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions exporter/exporterhelper/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ var (
errNilConfig = errors.New("nil config")
// errNilLogger is returned when a logger is nil
errNilLogger = errors.New("nil logger")
// errNilPushTraceData is returned when a nil traceDataPusher is given.
errNilPushTraceData = errors.New("nil traceDataPusher")
// errNilPushMetricsData is returned when a nil pushMetricsData is given.
errNilPushMetricsData = errors.New("nil pushMetricsData")
// errNilPushLogsData is returned when a nil pushLogsData is given.
errNilPushLogsData = errors.New("nil pushLogsData")
// errNilPushTraceData is returned when a nil PushTraces is given.
errNilPushTraceData = errors.New("nil PushTraces")
// errNilPushMetricsData is returned when a nil PushMetrics is given.
errNilPushMetricsData = errors.New("nil PushMetrics")
// errNilPushLogsData is returned when a nil PushLogs is given.
errNilPushLogsData = errors.New("nil PushLogs")
)
12 changes: 6 additions & 6 deletions exporter/exporterhelper/logshelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ import (
"go.opentelemetry.io/collector/obsreport"
)

// PushLogsData is a helper function that is similar to ConsumeLogsData but also returns
// PushLogs is a helper function that is similar to ConsumeLogs but also returns
// the number of dropped logs.
type PushLogsData func(ctx context.Context, md pdata.Logs) (droppedTimeSeries int, err error)
type PushLogs func(ctx context.Context, md pdata.Logs) (droppedTimeSeries int, err error)

type logsRequest struct {
baseRequest
ld pdata.Logs
pusher PushLogsData
pusher PushLogs
}

func newLogsRequest(ctx context.Context, ld pdata.Logs, pusher PushLogsData) request {
func newLogsRequest(ctx context.Context, ld pdata.Logs, pusher PushLogs) request {
return &logsRequest{
baseRequest: baseRequest{ctx: ctx},
ld: ld,
Expand All @@ -59,7 +59,7 @@ func (req *logsRequest) count() int {

type logsExporter struct {
*baseExporter
pushLogsData PushLogsData
pushLogsData PushLogs
}

func (lexp *logsExporter) ConsumeLogs(ctx context.Context, ld pdata.Logs) error {
Expand All @@ -72,7 +72,7 @@ func (lexp *logsExporter) ConsumeLogs(ctx context.Context, ld pdata.Logs) error
func NewLogsExporter(
cfg configmodels.Exporter,
logger *zap.Logger,
pushLogsData PushLogsData,
pushLogsData PushLogs,
options ...Option,
) (component.LogsExporter, error) {
if cfg == nil {
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporterhelper/logshelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func TestLogsExporter_WithShutdown_ReturnError(t *testing.T) {
assert.Equal(t, le.Shutdown(context.Background()), want)
}

func newPushLogsData(droppedTimeSeries int, retError error) PushLogsData {
func newPushLogsData(droppedTimeSeries int, retError error) PushLogs {
return func(ctx context.Context, td pdata.Logs) (int, error) {
return droppedTimeSeries, retError
}
Expand Down
12 changes: 6 additions & 6 deletions exporter/exporterhelper/metricshelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ import (
"go.opentelemetry.io/collector/obsreport"
)

// PushMetricsData is a helper function that is similar to ConsumeMetricsData but also returns
// PushMetrics is a helper function that is similar to ConsumeMetrics but also returns
// the number of dropped metrics.
type PushMetricsData func(ctx context.Context, md pdata.Metrics) (droppedTimeSeries int, err error)
type PushMetrics func(ctx context.Context, md pdata.Metrics) (droppedTimeSeries int, err error)

type metricsRequest struct {
baseRequest
md pdata.Metrics
pusher PushMetricsData
pusher PushMetrics
}

func newMetricsRequest(ctx context.Context, md pdata.Metrics, pusher PushMetricsData) request {
func newMetricsRequest(ctx context.Context, md pdata.Metrics, pusher PushMetrics) request {
return &metricsRequest{
baseRequest: baseRequest{ctx: ctx},
md: md,
Expand All @@ -60,7 +60,7 @@ func (req *metricsRequest) count() int {

type metricsExporter struct {
*baseExporter
pusher PushMetricsData
pusher PushMetrics
}

func (mexp *metricsExporter) ConsumeMetrics(ctx context.Context, md pdata.Metrics) error {
Expand All @@ -77,7 +77,7 @@ func (mexp *metricsExporter) ConsumeMetrics(ctx context.Context, md pdata.Metric
func NewMetricsExporter(
cfg configmodels.Exporter,
logger *zap.Logger,
pushMetricsData PushMetricsData,
pushMetricsData PushMetrics,
options ...Option,
) (component.MetricsExporter, error) {
if cfg == nil {
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporterhelper/metricshelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestMetricsExporter_WithShutdown_ReturnError(t *testing.T) {
assert.Equal(t, me.Shutdown(context.Background()), want)
}

func newPushMetricsData(droppedTimeSeries int, retError error) PushMetricsData {
func newPushMetricsData(droppedTimeSeries int, retError error) PushMetrics {
return func(ctx context.Context, td pdata.Metrics) (int, error) {
return droppedTimeSeries, retError
}
Expand Down
12 changes: 6 additions & 6 deletions exporter/exporterhelper/tracehelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ import (
"go.opentelemetry.io/collector/obsreport"
)

// traceDataPusher is a helper function that is similar to ConsumeTraceData but also
// PushTraces is a helper function that is similar to ConsumeTraces but also
// returns the number of dropped spans.
type traceDataPusher func(ctx context.Context, td pdata.Traces) (droppedSpans int, err error)
type PushTraces func(ctx context.Context, td pdata.Traces) (droppedSpans int, err error)

type tracesRequest struct {
baseRequest
td pdata.Traces
pusher traceDataPusher
pusher PushTraces
}

func newTracesRequest(ctx context.Context, td pdata.Traces, pusher traceDataPusher) request {
func newTracesRequest(ctx context.Context, td pdata.Traces, pusher PushTraces) request {
return &tracesRequest{
baseRequest: baseRequest{ctx: ctx},
td: td,
Expand All @@ -59,7 +59,7 @@ func (req *tracesRequest) count() int {

type traceExporter struct {
*baseExporter
pusher traceDataPusher
pusher PushTraces
}

func (texp *traceExporter) ConsumeTraces(ctx context.Context, td pdata.Traces) error {
Expand All @@ -73,7 +73,7 @@ func (texp *traceExporter) ConsumeTraces(ctx context.Context, td pdata.Traces) e
func NewTraceExporter(
cfg configmodels.Exporter,
logger *zap.Logger,
dataPusher traceDataPusher,
dataPusher PushTraces,
options ...Option,
) (component.TracesExporter, error) {

Expand Down
2 changes: 1 addition & 1 deletion exporter/exporterhelper/tracehelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestTraceExporter_WithShutdown_ReturnError(t *testing.T) {
assert.Equal(t, te.Shutdown(context.Background()), want)
}

func newTraceDataPusher(droppedSpans int, retError error) traceDataPusher {
func newTraceDataPusher(droppedSpans int, retError error) PushTraces {
return func(ctx context.Context, td pdata.Traces) (int, error) {
return droppedSpans, retError
}
Expand Down

0 comments on commit 6adb673

Please sign in to comment.