Skip to content

[beats receivers] Only run components with supported outputs as Beats receivers #9696

@cmacknz

Description

@cmacknz

Right now the only supported output type is Elasticsearch:

OtelSupportedOutputTypes = []string{"elasticsearch"}

Components are however split between the sub-process and otel runtime based solely on the feature flag state right now:

switch comp.RuntimeManager {
case component.OtelRuntimeManager:
otelComponents = append(otelComponents, comp)
case component.ProcessRuntimeManager:
runtimeComponents = append(runtimeComponents, comp)

When an unsupported output is used with Beats receivers, it is sent to the OTel configuration manager which will detect it can't correctly translate configurations with the unsupported output type and simply not run it. This will break users using non-Elasticsearch outputs (Kafka, Logstash) today when we default agent monitoring to use beats receivers by default.

if len(cfgUpdate.components) > 0 {
model := &component.Model{Components: cfgUpdate.components}
var err error
componentOtelCfg, err = translate.GetOtelConfig(model, agentInfo, monitoringConfigGetter)
if err != nil {
return nil, fmt.Errorf("failed to generate otel config: %w", err)
}
}

// getSupportedComponents returns components from the given model that can be run in an Otel Collector.
func getSupportedComponents(model *component.Model) []*component.Component {
var supportedComponents []*component.Component
for _, comp := range model.Components {
if IsComponentOtelSupported(&comp) {
supportedComponents = append(supportedComponents, &comp)
}
}

// IsComponentOtelSupported checks if the given component can be run in an Otel Collector.
func IsComponentOtelSupported(comp *component.Component) bool {
return slices.Contains(OtelSupportedOutputTypes, comp.OutputType) &&
slices.Contains(OtelSupportedInputTypes, comp.InputType)
}

Acceptance Criteria

  • A test exists proving that a configuration using either of the unsupported Logstash or Kafka outputs as the monitoring output when agent.monitoring._runtime_experimental: otel is set continues to run the monitoring beats as sub-processes.
    • A log line and the agent diagnostics clearly indicate the monitoring beats continue to be run as sub-processes even though it was requested to run them as receivers.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions