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

[receiver/kafkareceiver] Feature/kafkareceiver avro #21068

Closed

Conversation

vincentfree
Copy link
Contributor

Description: Adding avro encoding for kafkareceiver.

Link to tracking Issue: #21067

Testing: added basic test for the new functionality and new yaml config structures

Documentation: added documentation for new config items and an extra example showing how to use Avro structured logging with field mapping and schema referencing

@vincentfree vincentfree requested a review from a team April 19, 2023 05:58
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 19, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those changes look fantastic. Would you be open to becoming a codeowner of this code specifically so we can use your expertise to maintain it going forward?

@thmshmm
Copy link
Contributor

thmshmm commented Apr 21, 2023

Sounds good. Only for the avro part?

@atoulme
Copy link
Contributor

atoulme commented Apr 21, 2023

Yes? I’m offering but it’s not really up to me. The existing codeowners will weigh in. Given the complexity of the code, I am sure they would be more comfortable with it if you stick around.

@thmshmm
Copy link
Contributor

thmshmm commented Apr 21, 2023

Yes of course.

@atoulme
Copy link
Contributor

atoulme commented Apr 22, 2023

Please add yourself in .github/CODEOWNERS for the file specifically related to avro, and rebase this PR off the latest main to pick up a fix that is breaking integration tests.

@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch 3 times, most recently from 0ce432e to 39902ad Compare April 24, 2023 07:18
@vincentfree vincentfree force-pushed the feature/kafkareceiver-avro branch from 9155c14 to c27c617 Compare April 24, 2023 07:52
@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch from c27c617 to 39902ad Compare April 24, 2023 08:00
@vincentfree vincentfree force-pushed the feature/kafkareceiver-avro branch from 39902ad to b5ceb8e Compare April 24, 2023 08:05
@thmshmm
Copy link
Contributor

thmshmm commented Apr 24, 2023

@atoulme do you know how it is possible to specify ownership for single files?
The test fails
"receiver/kafkareceiver/avro_unmarshaler.go" does not exist as specified in CODEOWNERS

@atoulme
Copy link
Contributor

atoulme commented Apr 24, 2023

Oh just run make generate-gh-issue-templates we generate a dropdown from codeowners values for github issues and the PR doesn't like that this is out of sync.

@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch from c3225ea to 52a1ba8 Compare April 27, 2023 07:37
@thmshmm
Copy link
Contributor

thmshmm commented Apr 27, 2023

Rebased main again and removed the file ownership which seems to not work.

@vincentfree vincentfree force-pushed the feature/kafkareceiver-avro branch from 02d9e00 to a925d08 Compare April 27, 2023 20:19
@vincentfree
Copy link
Contributor Author

All should be good now

@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch from a925d08 to b55de84 Compare May 8, 2023 11:47
Copy link
Contributor

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I ask you to update the following:

  • Load definition from a provided configuration
  • Provide a means of creating immutable Avro serialises

I really worry that it will over complicate the required logic to make it both concurrency safe and feel more at ease with static serialisers.

It is my understanding that Avro will need definition so it knows how to translate the values, hence the Init method?

I think it makes sense to update the marshaler's loaders to include reading from *Config.Encoding (I forget the actual type, but something to that affect).

I have a few other comments elsewhere but it is more to improve my understand and provide more help.

receiver/kafkareceiver/avro_unmarshaler.go Outdated Show resolved Hide resolved
receiver/kafkareceiver/avro_unmarshaler.go Outdated Show resolved Hide resolved
}

func newAVROFileSchemaDeserializer(path string) (avroDeserializer, error) {
schema, err := loadAVROSchemaFromFile(path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, could we avoid having a strict method to read from disk when ideally we'd want to read the definition from the configuration?

If you want to make it easier to test with, I changing the method handler to:

func readAVROSchema(r io.Reader) (schema, error)

This would allow you to use bytes.NewBuffer, strings.Reader, or os.File without needing to change the code path that does the main work and make it easier to test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason we'd want to avoid it to require loading from disk is that we also have to considering the potential security vector that someone could try load from incorrect path (ie: ../../../../../../../../../etc/passwd).

The config loaders can do this for us to make life easier and not having to repeat the same work again*

*Unless we really must have to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comments, i'll address them.

@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch from b55de84 to 4fa0447 Compare May 8, 2023 12:44
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label May 26, 2023
@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch from 4fa0447 to 9a8a506 Compare June 7, 2023 09:06
@spockz
Copy link

spockz commented Jul 12, 2023

Who needs to sign off on this PR?

@atoulme atoulme removed the Stale label Jul 12, 2023
@atoulme
Copy link
Contributor

atoulme commented Jul 12, 2023

@MovieStoreGuy is the right person to review. I have also triggered the tests just now and removed the stale tag. Please follow up if tests fail.

@thmshmm thmshmm force-pushed the feature/kafkareceiver-avro branch from 5cc6a5d to 250a3d4 Compare July 14, 2023 07:39
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 29, 2023
@vincentfree
Copy link
Contributor Author

vincentfree commented Jul 29, 2023

@MovieStoreGu'm can you or someone else please review this PR?

@atoulme @pavolloffay Is there a larger group of maintainers that could review this PR?

@github-actions github-actions bot removed the Stale label Jul 30, 2023
Copy link
Contributor

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes make sense to me but I would like to see a exporter definition in a future PR please.


func setAttribute(attributes *pcommon.Map, key string, value interface{}) {
attribute := attributes.PutEmpty(key)
_ = attribute.FromRaw(value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the error being ignored?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this should have read, Why is this error be ignored?

kafka:
encoding: avro
avro:
schema: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reference to an external resource that would help someone who is new to avro to understand what is best to put here?

@MovieStoreGuy
Copy link
Contributor

Apologies that I hadn't reviewed this sooner.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Sep 1, 2023
@github-actions github-actions bot removed the Stale label Sep 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2023

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 4, 2023
@github-actions
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Oct 19, 2023
@thmshmm
Copy link
Contributor

thmshmm commented Oct 25, 2023

please reopen, pushed the reimplementation based on my comments from #21067

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.

6 participants