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

implement kafka-exporter #965

Merged
merged 5 commits into from
Jan 10, 2024
Merged

Conversation

naser-ayat
Copy link
Contributor

@naser-ayat naser-ayat commented Jul 20, 2023

Description:

The kafka-exporter module is added. This module contains KafkaSpanExporter (an implementation of the SpanExporter interface) that can be used for sending SpanData to Kafka.

Existing Issue(s):
Solves #145

Testing:

The module contains both unit tests and an integration test.

Documentation:

A README file documents the usage

@naser-ayat naser-ayat requested a review from a team July 20, 2023 16:24
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@naser-ayat
Copy link
Contributor Author

/easycla

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 21, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@naser-ayat
Copy link
Contributor Author

/easycla

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

hi @naser-ayat!

are you willing to be a component owner for this going forward?

ideally we would like to have two component owners, maybe try posting in the #otel-java slack channel to see if anyone else is interested as well?

this.timeoutInSeconds = timeoutInSeconds;
}

public KafkaSpanExporter(
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding more constructors you might want to opt in for using static factory methods or a builder like pattern. I would think static factory methods make the code much clearer. You could use some default names like create to replace the main constructor, and I've used things like basic, and with timeout etc etc as other options.

This gives the replacements names and makes it easier to work with.
But looking at all of the options you have a Builder might be a good option as well. probably with some default/required fields to start with

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A builder is added.

@Override
public ExportTraceServiceRequest deserialize(String topic, byte[] data) {
if (Objects.isNull(data)) {
return ExportTraceServiceRequest.getDefaultInstance();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you return an empty event? I think if it's not a valid response it should throw. Empty events hide the fact that nothing worthy of processing can be returned

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the Deserialiser interface documentation, it states that the 'data' parameter, which represents serialized bytes, may be null. Implementations are advised to handle null by either returning a value or null instead of throwing an exception. That's why the exception is not thrown. I personally opted for returning an empty object to simplify dealing with null values in the callers. If you prefer to receive null values, please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Returning a empty value creates a valid return value that in turn needs to be validated at the client side. This hides the fact that the the incoming event could not be deserialized.

In other words it transforms the result to a successful event with no content. Default null handling of client side libraries might be a better solution here. I understand that null doesn't seem like the best return value but based what you said about the docs this is the better return type here imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to null

@naser-ayat

This comment was marked as duplicate.

@naser-ayat
Copy link
Contributor Author

naser-ayat commented Jul 25, 2023

hi @naser-ayat!

are you willing to be a component owner for this going forward?

ideally we would like to have two component owners, maybe try posting in the #otel-java slack channel to see if anyone else is interested as well?

We're currently discussing this at ING and will provide an update soon. Additionally, I've sent a message to the Slack channel to see if anyone else is interested.

@naser-ayat naser-ayat closed this Jul 25, 2023
@naser-ayat naser-ayat reopened this Jul 25, 2023
@spockz
Copy link

spockz commented Nov 14, 2023

hi @naser-ayat!
are you willing to be a component owner for this going forward?
ideally we would like to have two component owners, maybe try posting in the #otel-java slack channel to see if anyone else is interested as well?

We're currently discussing this at ING and will provide an update soon. Additionally, I've sent a message to the Slack channel to see if anyone else is interested.

I'm interested in being a component owner.

@@ -58,3 +58,6 @@ components:
- trask
static-instrumenter:
- anosek-an
kafka-exporter:
- spockz
Copy link

Choose a reason for hiding this comment

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

Approved.

@@ -58,3 +58,6 @@ components:
- trask
static-instrumenter:
- anosek-an
kafka-exporter:
- spockz
- vincentfree
Copy link
Member

Choose a reason for hiding this comment

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

@naser-ayat did you want to be a component owner as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two component owners should be enough. Thanks for the suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vincentfree Could you please approve the PR?

Copy link
Member

Choose a reason for hiding this comment

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

it would be great to get approvals from both of the component owners

Copy link
Contributor

Choose a reason for hiding this comment

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

Approved on my part 👍

Copy link
Member

Choose a reason for hiding this comment

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

@vincentfree can you approve via github? thx!

image

Copy link
Member

Choose a reason for hiding this comment

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

@spockz ^^ can you approve via github also?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done, sorry was going to do an actual review but I did that before so that's fine now. finally came around to click that button :)

@trask trask merged commit 8f22e5a into open-telemetry:main Jan 10, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.