Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/kafkaexporter] Add encoding extensions support #34384

Merged

Conversation

thmshmm
Copy link
Contributor

@thmshmm thmshmm commented Aug 1, 2024

Description: Add support for encoding extensions in the kafkaexporter

To be able to use encoding extensions this PR adds extension support and proposes to rename the existing encoding configuration property to format and reusing the encoding property for configuring encoding extensions. Reason is to be consistent with other receivers/exporters.

Related to #33888 which adds encoding extension support in the kafkareceiver.

Link to tracking Issue: n/a

Testing: Tested via the following configuration.

receivers:
  kafka:
    brokers:
    - localhost:29092
    encoding: json
    group_id: test1
    topic: logs_in

extensions:
  json_log_encoding:

exporters:
  debug:
    verbosity: detailed
  kafka:
    brokers:
      - localhost:29092
    encoding: json_log_encoding
    topic: json_out

processors:
  batch:

service:
  extensions: [json_log_encoding]
  pipelines:
    logs:
      receivers: [kafka]
      processors: [batch]
      exporters: [debug, kafka]
  telemetry:
    logs:
      level: "info"

Any json can be written to the logs_in topic and results be viewed in the json_out topic.

When removing encoding: json_log_encoding the default format type is used and the output in json_out topic changes accordingly.

Documentation: Updated README.md within the receiver describing the use of encoding extensions.

@thmshmm thmshmm force-pushed the feature/kafkaexporter-enc-ext branch 2 times, most recently from 5ef1de6 to 6caca3e Compare August 10, 2024 15:21
@thmshmm
Copy link
Contributor Author

thmshmm commented Aug 23, 2024

@MovieStoreGuy can you please review?

@thmshmm thmshmm force-pushed the feature/kafkaexporter-enc-ext branch 2 times, most recently from 07c1a1d to eca44da Compare September 6, 2024 06:42
@MovieStoreGuy
Copy link
Contributor

Hey @thmshmm,

Do you mind doing the same again here where it failsover to the local encodings if there is no encoding extension defined?

@thmshmm thmshmm force-pushed the feature/kafkaexporter-enc-ext branch from eca44da to 4385cac Compare September 10, 2024 11:16
@thmshmm thmshmm force-pushed the feature/kafkaexporter-enc-ext branch from eecdaf3 to 4646725 Compare September 11, 2024 11:48
@MovieStoreGuy MovieStoreGuy merged commit 21208c0 into open-telemetry:main Sep 12, 2024
155 of 156 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 12, 2024
jriguera pushed a commit to springernature/opentelemetry-collector-contrib that referenced this pull request Oct 4, 2024
…try#34384)

**Description:** Add support for encoding extensions in the
kafkaexporter

To be able to use encoding extensions this PR adds extension support and
proposes to rename the existing `encoding` configuration property to
`format` and reusing the `encoding` property for configuring encoding
extensions. Reason is to be consistent with other receivers/exporters.

Related to
open-telemetry#33888
which adds encoding extension support in the `kafkareceiver`.

**Link to tracking Issue:** n/a

**Testing:** Tested via the following configuration.
```
receivers:
  kafka:
    brokers:
    - localhost:29092
    encoding: json
    group_id: test1
    topic: logs_in

extensions:
  json_log_encoding:

exporters:
  debug:
    verbosity: detailed
  kafka:
    brokers:
      - localhost:29092
    encoding: json_log_encoding
    topic: json_out

processors:
  batch:

service:
  extensions: [json_log_encoding]
  pipelines:
    logs:
      receivers: [kafka]
      processors: [batch]
      exporters: [debug, kafka]
  telemetry:
    logs:
      level: "info"
```

Any json can be written to the `logs_in` topic and results be viewed in
the `json_out` topic.

When removing `encoding: json_log_encoding` the default format type is
used and the output in `json_out` topic changes accordingly.

**Documentation:** Updated README.md within the receiver describing the
use of encoding extensions.

Co-authored-by: Sean Marciniak <30928402+MovieStoreGuy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants