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

Support for RocketMQ #1356

Closed
wants to merge 0 commits into from
Closed

Support for RocketMQ #1356

wants to merge 0 commits into from

Conversation

JoeKerouac
Copy link

@JoeKerouac JoeKerouac commented Jan 12, 2023

Support for RocketMQ 4.6.0+.

see #1043

@JoeKerouac
Copy link
Author

@jcchavezs

@JoeKerouac
Copy link
Author

@jcchavezs Pipeline failures that appear to be caused by expired license headers for old files

@JoeKerouac
Copy link
Author

@jcchavezs @jeqo @shakuzen license has been updated

@JoeKerouac
Copy link
Author

@jcchavezs @jeqo @shakuzen
There is a PR to merge the main branch. This branch is not synchronized in time, which leads to CI failure and has been merged.

@JoeKerouac
Copy link
Author

JoeKerouac commented Mar 1, 2023

@jeqo @shakuzen All checks have passed

Copy link
Member

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

good job. I made some comments. Please rebase on master before proceeding for next review round.

* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package brave.rocketmq.clients;
Copy link
Member

Choose a reason for hiding this comment

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

make this "client" to match the artifact name please

instrumentation/rocketmq/bnd.bnd Outdated Show resolved Hide resolved
import org.apache.rocketmq.common.message.MessageExt;

/**
* @author JoeKerouac
Copy link
Member

Choose a reason for hiding this comment

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

no author tags please

* @author JoeKerouac
* @date 2023-01-09 15:02
*/
public class ConsumeMessageBraveHookImpl implements ConsumeMessageHook {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public class ConsumeMessageBraveHookImpl implements ConsumeMessageHook {
public class TracingConsumeMessageHook implements ConsumeMessageHook {

Copy link
Member

Choose a reason for hiding this comment

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

also does this need to be public? if not, make it package private

import java.util.Map;

/**
* @author JoeKerouac
Copy link
Member

Choose a reason for hiding this comment

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

look at our other packages and make JavaDoc and also a README similarly

*/
class SpanUtil {

static <T extends MessagingRequest> Span createAndStartSpan(RocketMQTracing tracing,
Copy link
Member

Choose a reason for hiding this comment

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

maybe this can move into RocketMQTracing


static final String EMPTY = "";

static String getOrEmpty(String obj) {
Copy link
Member

Choose a reason for hiding this comment

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

move to RocketMQTracing

* @author JoeKerouac
* @date 2023-01-10 15:19
*/
public class TraceConstants {
Copy link
Member

Choose a reason for hiding this comment

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

look at how other packages define constants and use similar naming scheme

Copy link
Author

Choose a reason for hiding this comment

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

I've been busy lately. I will deal with it in the next two days.

@JoeKerouac
Copy link
Author

@codefromthecrypt Please help review again

Copy link
Member

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

Thanks.. I really want to help you land this, but we need to start smaller. Try to reduce the amount of code here, in tagging and tests to minimal. Also remove the spring option for now. If you can reduce the code to the size of other instrumentation, it will be easier for me to help you land this, then we can enhance it with less context.

<profile>
<id>netty-module</id>
<activation>
<jdk>[9,)</jdk>
Copy link
Member

Choose a reason for hiding this comment

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

minimum JDK of brave is 11 now, so you can make this a default property

<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>${testArgLine}</argLine>
Copy link
Member

Choose a reason for hiding this comment

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

instead of adding this, add to properties what you want as maven-surefire-plugin.argLine because the below is in the parent pom now

    <maven-surefire-plugin.argLine />
    <maven-failsafe-plugin.argLine />

<build>
<plugins>
<plugin>
<groupId>net.orfjackal.retrolambda</groupId>
Copy link
Member

Choose a reason for hiding this comment

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

not needed as no longer used


<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

use this and then in the tests that use docker, do something like this:

@Tag("docker")
@Testcontainers(disabledWithoutDocker = true)
@Timeout(60)
class ITRocketMQ {
  @Container RocketMQContainer rocketmq = new RocketMQContainer();
Suggested change
<artifactId>testcontainers</artifactId>
<artifactId>junit-jupiter</artifactId>

<main.java.version>1.6</main.java.version>
<main.signature.artifact>java17</main.signature.artifact>

<old-kafka-clients.version>1.0.0</old-kafka-clients.version>
Copy link
Member

Choose a reason for hiding this comment

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

remove anything about kafka

<module.name>brave.rocketmq.clients</module.name>

<main.basedir>${project.basedir}/../..</main.basedir>
<main.java.version>1.6</main.java.version>
Copy link
Member

Choose a reason for hiding this comment

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

this approach has changed. If rocketMQ is floor java 6, then copy style from another Java 6 thing like JMS. look carefully and setup pom the same way


public static final class Builder {
final MessagingTracing messagingTracing;
String remoteServiceName = TraceConstants.ROCKETMQ_SERVICE;
Copy link
Member

Choose a reason for hiding this comment

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

inline this as it is easier. the rest will make more sense later.

SpanUtil.createAndStartSpan(tracing, tracing.producerExtractor, tracing.producerSampler,
request,
msg.getProperties());
span.name(TraceConstants.TO_PREFIX + msg.getTopic());
Copy link
Member

Choose a reason for hiding this comment

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

look at the other messaging implementations, and notice that we do not add any non-default tags to the span. That's what customization is for, and it also significantly reduces the amount of code and constants to review.

Similar to KafkaTags start only with very very minimal, like pick 2 tags and delete everything else from this PR that isn't required to pass similarly

}
}

@BeforeAll
Copy link
Member

Choose a reason for hiding this comment

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

per other note.. use @Container to manage these

Copy link
Author

Choose a reason for hiding this comment

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

I have already resolved the above issue. Please help review

Copy link
Member

Choose a reason for hiding this comment

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

sorry maybe I wasn't clear. I meant literally use @Container and like how it is done in https://github.com/openzipkin/brave/blob/master/instrumentation/kafka-clients/src/test/java/brave/kafka/clients/ITKafkaTracing.java

once this is done and the other comments including removing spring are, I'll review again, but not before. that way I don't need to repeat existing comments and you can have focus on what's needed to land this.

One thing is that once this is in, we'll likely have to publish our own image for rocketmq to avoid docker.io rate limiting, but I can help with that

Copy link
Author

Choose a reason for hiding this comment

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

@codefromthecrypt I still don't quite understand your meaning. Regarding the use of @Container, I have already replaced @BeforeAll with @Container in the test cases. As for removing spring, are you referring to removing the spring-boot-rocketmq module?

Copy link
Member

Choose a reason for hiding this comment

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

we currently do not have any code for spring boot, only minimal properties for some libraries whose primary abstraction is spring (spring-rabbit), so adding spring boot to this is more of a decision (e.g. why not micrometer/tracing, vs sleuth etc) Since all brave is low-level where possible, it is easy to make a "go" decision on the main rocketmq even if we don't put autoconfigure into this repo. Adding autoconfig here is adding more work forever to the maintainers and possibly in conflict with some other projects.

on testcontainers, it appears your last commit did what I mentioned.

So, let's remove the spring boot stuff from this PR and try to land it. If your PR is marked to allow edits by maintainers, I can help with small things after you remove the spring boot. sound ok?

Copy link
Author

Choose a reason for hiding this comment

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

@codefromthecrypt I have removed the Spring part. and the PR has been marked to allow edits by maintainers.

@codefromthecrypt
Copy link
Member

Thanks @JoeKerouac! I have some heavy work activity in next two days, but will try to land it, if not definitely on Monday

@codefromthecrypt
Copy link
Member

@JoeKerouac if you don't mind looking into the test failures before I go for review and style fixes, would be appreciated

@JoeKerouac
Copy link
Author

@codefromthecrypt Sure, I will handle it as soon as possible.

@JoeKerouac
Copy link
Author

I have fixed the failed test case.

Copy link
Member

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

I will commit my suggestions, then fix the build and push any other feedback fixes

@codefromthecrypt
Copy link
Member

@JoeKerouac since you raised this PR from master me pushing to that closed this PR. Can you please make a branch off your master and push that as a new PR? The only commit for that PR being what I just pushed.

Later there is some follow-up. For example, the docker image is not multi-platform, and it needs to be multi-platform to proceed (at least amd64 and arm64, currently, it is single-platform arm64)

@codefromthecrypt
Copy link
Member

I saved a copy of the commit here in case you lose it https://github.com/openzipkin/brave/compare/rocketmq-client

@JoeKerouac JoeKerouac mentioned this pull request Jan 31, 2024
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.

2 participants