Skip to content

Extend the support for partition_logs_by_resource_attributes to raw encoding #38999

Closed
@namco1992

Description

@namco1992

Component(s)

exporter/kafka

Is your feature request related to a problem? Please describe.

We've migrated our logging pipeline partially to Otel. We used to have a ELK stack, and now we still persist the logstash that receives logs from a Kafka topic, and insert them to ElasticSearch. On the producer side, we have an Otel collector with Kafka exporter. To keep the backward compatibility, we use the raw encoding in the Kafka exporter, but it doesn't support partition_logs_by_resource_attributes:

switch encoding {
case defaultEncoding:
return newPdataLogsMarshaler(&plog.ProtoMarshaler{}, defaultEncoding, partitionLogsByAttributes), nil
case "otlp_json":
return newPdataLogsMarshaler(&plog.JSONMarshaler{}, "otlp_json", partitionLogsByAttributes), nil
case raw.Encoding():
return raw, nil
default:
return nil, errUnrecognizedEncoding

I don't see why the raw encoding can't do the same thing as other encodings. The raw marshaler indeed discards the resource and record attributes in the end result (i.e. the message sent to the Kafka), but it still has the access to attributes during marshalling, just as other marshalers.

Describe the solution you'd like

The raw encoding should support partition_logs_by_resource_attributes too. Also if #38484 is accepted, raw encoding should also support it.

Describe alternatives you've considered

No response

Additional context

No response

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