Skip to content

Commit

Permalink
mdatagen: Call connectors with routers to be the same as the service …
Browse files Browse the repository at this point in the history
…graph (#10079)
  • Loading branch information
bogdandrutu authored May 3, 2024
1 parent 109173d commit aeb0cf0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
20 changes: 20 additions & 0 deletions .chloggen/callconnectorwithrouter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Call connectors with routers to be the same as the service graph

# One or more tracking issues or pull requests related to the change
issues: [10079]

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
27 changes: 18 additions & 9 deletions cmd/mdatagen/templates/component_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -371,71 +371,80 @@ func TestComponentLifecycle(t *testing.T) {
{
name: "logs_to_logs",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateLogsToLogs(ctx, set, cfg, consumertest.NewNop())
router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()})
return factory.CreateLogsToLogs(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsLogsToMetrics }}
{
name: "logs_to_metrics",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateLogsToMetrics(ctx, set, cfg, consumertest.NewNop())
router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()})
return factory.CreateLogsToMetrics(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsLogsToTraces }}
{
name: "logs_to_traces",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateLogsToTraces(ctx, set, cfg, consumertest.NewNop())
router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()})
return factory.CreateLogsToTraces(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsMetricsToLogs }}
{
name: "metrics_to_logs",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateMetricsToLogs(ctx, set, cfg, consumertest.NewNop())
router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()})
return factory.CreateMetricsToLogs(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsMetricsToMetrics }}
{
name: "metrics_to_metrics",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateMetricsToMetrics(ctx, set, cfg, consumertest.NewNop())
router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()})
return factory.CreateMetricsToMetrics(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsMetricsToTraces }}
{
name: "metrics_to_traces",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateMetricsToTraces(ctx, set, cfg, consumertest.NewNop())
router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()})
return factory.CreateMetricsToTraces(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsTracesToLogs }}
{
name: "traces_to_logs",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateTracesToLogs(ctx, set, cfg, consumertest.NewNop())
router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()})
return factory.CreateTracesToLogs(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsTracesToMetrics }}
{
name: "traces_to_metrics",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateTracesToMetrics(ctx, set, cfg, consumertest.NewNop())
router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()})
return factory.CreateTracesToMetrics(ctx, set, cfg, router)
},
},
{{ end }}
{{ if supportsTracesToTraces }}
{
name: "traces_to_traces",
createFn: func(ctx context.Context, set connector.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateTracesToTraces(ctx, set, cfg, consumertest.NewNop())
router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()})
return factory.CreateTracesToTraces(ctx, set, cfg, router)
},
},
{{ end }}
Expand Down
10 changes: 7 additions & 3 deletions connector/forwardconnector/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aeb0cf0

Please sign in to comment.