Skip to content

Commit

Permalink
[chore] Clean up naming in testcomponent package (#12072)
Browse files Browse the repository at this point in the history
This PR just cleans up some naming in the `testcomponents` package, so
that no component kind has a monopoly on the generic version of a
variable or function name.

Subset of #12057
  • Loading branch information
djaglowski authored Jan 10, 2025
1 parent 8e7efa2 commit 7425fe8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
14 changes: 6 additions & 8 deletions service/internal/testcomponents/example_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ import (
"go.opentelemetry.io/collector/pdata/ptrace"
)

var testType = component.MustNewType("exampleexporter")

const stability = component.StabilityLevelDevelopment
var exporterType = component.MustNewType("exampleexporter")

// ExampleExporterFactory is factory for ExampleExporter.
var ExampleExporterFactory = xexporter.NewFactory(
testType,
exporterType,
createExporterDefaultConfig,
xexporter.WithTraces(createTracesExporter, stability),
xexporter.WithMetrics(createMetricsExporter, stability),
xexporter.WithLogs(createLogsExporter, stability),
xexporter.WithProfiles(createProfilesExporter, stability),
xexporter.WithTraces(createTracesExporter, component.StabilityLevelDevelopment),
xexporter.WithMetrics(createMetricsExporter, component.StabilityLevelDevelopment),
xexporter.WithLogs(createLogsExporter, component.StabilityLevelDevelopment),
xexporter.WithProfiles(createProfilesExporter, component.StabilityLevelDevelopment),
)

func createExporterDefaultConfig() component.Config {
Expand Down
16 changes: 8 additions & 8 deletions service/internal/testcomponents/example_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ var receiverType = component.MustNewType("examplereceiver")
var ExampleReceiverFactory = xreceiver.NewFactory(
receiverType,
createReceiverDefaultConfig,
xreceiver.WithTraces(createTraces, component.StabilityLevelDevelopment),
xreceiver.WithMetrics(createMetrics, component.StabilityLevelDevelopment),
xreceiver.WithLogs(createLogs, component.StabilityLevelDevelopment),
xreceiver.WithProfiles(createProfiles, component.StabilityLevelDevelopment),
xreceiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment),
xreceiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment),
xreceiver.WithLogs(createLogsReceiver, component.StabilityLevelDevelopment),
xreceiver.WithProfiles(createProfilesReceiver, component.StabilityLevelDevelopment),
)

func createReceiverDefaultConfig() component.Config {
return &struct{}{}
}

// createTraces creates a receiver.Traces based on this config.
func createTraces(
func createTracesReceiver(
_ context.Context,
_ receiver.Settings,
cfg component.Config,
Expand All @@ -42,7 +42,7 @@ func createTraces(
}

// createMetrics creates a receiver.Metrics based on this config.
func createMetrics(
func createMetricsReceiver(
_ context.Context,
_ receiver.Settings,
cfg component.Config,
Expand All @@ -54,7 +54,7 @@ func createMetrics(
}

// createLogs creates a receiver.Logs based on this config.
func createLogs(
func createLogsReceiver(
_ context.Context,
_ receiver.Settings,
cfg component.Config,
Expand All @@ -66,7 +66,7 @@ func createLogs(
}

// createProfiles creates a receiver.Profiles based on this config.
func createProfiles(
func createProfilesReceiver(
_ context.Context,
_ receiver.Settings,
cfg component.Config,
Expand Down

0 comments on commit 7425fe8

Please sign in to comment.