Skip to content

[receiver/awsfirehose] Encoding configuration fails if the ID contains / #39808

Closed
@constanca-m

Description

@constanca-m

Component(s)

receiver/awsfirehose

What happened?

Description

The encoding extension fails if it contains an ID with /. The error comes from:

componentType, err := component.NewType(encoding)
if err != nil {
return nil, fmt.Errorf("invalid component type: %w", err)
}

The NewType function:

// NewType creates a type. It returns an error if the type is invalid.
// A type must
// - have at least one character,
// - start with an ASCII alphabetic character and
// - can only contain ASCII alphanumeric characters and '_'.

Instead of encoding being a string, it could be a component.ID to get rid of this bug.

Steps to Reproduce

You can reproduce it using:

extensions:
  awslogs_encoding/cloudwatch:
    format: cloudwatch_logs_subscription_filter

receivers:
  awsfirehose:
    endpoint: :1234
    encoding: awslogs_encoding/cloudwatch

You will see the collector fails with:

Error: cannot start pipelines: failed to start "awsfirehose/cwlogs" receiver: failed to start consumer: failed to load encoding extension: invalid component type: invalid character(s) in type "awslogs_encoding/cloudwatch"

Expected Result

I expect it work without issues, and that the receiver can load the encoding extension by its ID.

Actual Result

The collector does not start:

Error: cannot start pipelines: failed to start "awsfirehose/cwlogs" receiver: failed to start consumer: failed to load encoding extension: invalid component type: invalid character(s) in type "awslogs_encoding/cloudwatch"

Collector version

v0.125.0

Environment information

Environment

OS: Ubuntu 24.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions