Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/plugins-test.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
- kafka-scenario
- kotlin-coroutine-scenario
- lettuce-scenario
- lettuce-6.5.x-scenario
- mongodb-3.x-scenario
- mongodb-4.x-scenario
- netty-socketio-scenario
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release Notes.
* Fix retransform failure when enhancing both parent and child classes.
* Add support for `dameng(DM)` JDBC url format in `URLParser`.
* Fix RabbitMQ Consumer could not receive handleCancelOk callback.
* Support for tracking in lettuce versions 6.5.x and above.

All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/236?closed=1)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.skywalking</groupId>
<artifactId>lettuce-plugins</artifactId>
<version>9.5.0-SNAPSHOT</version>
</parent>

<artifactId>apm-lettuce-5.x-plugin</artifactId>
<packaging>jar</packaging>

<name>lettuce-5.x-plugin</name>

<properties>
<lettuce-core.version>5.0.0.RELEASE</lettuce-core.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-lettuce-common</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>${lettuce-core.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.skywalking.apm.plugin.lettuce.v5;

import io.lettuce.core.protocol.ProtocolKeyword;
import org.apache.skywalking.apm.plugin.lettuce.common.RedisChannelWriterInterceptor;

public class RedisChannelWriterInterceptorV5 extends RedisChannelWriterInterceptor {
@Override
protected String getCommandName(final ProtocolKeyword protocol) {
return protocol.name();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.skywalking.apm.plugin.lettuce.v5.constant;

import net.bytebuddy.matcher.ElementMatchers;
import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;

/**
* Lettuce 5.x plugin constants
*/

public class Constants {

public static final WitnessMethod WITNESS_LETTUCE_5X_METHOD = new WitnessMethod(
"io.lettuce.core.protocol.ProtocolKeyword",
ElementMatchers.named("name")
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.skywalking.apm.plugin.lettuce.v5.define;

import java.util.Collections;
import java.util.List;
import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
import org.apache.skywalking.apm.plugin.lettuce.common.define.DefaultEndpointInstrumentation;
import org.apache.skywalking.apm.plugin.lettuce.v5.constant.Constants;

public class DefaultEndpointInstrumentationV5 extends DefaultEndpointInstrumentation {

@Override
protected List<WitnessMethod> witnessMethods() {
return Collections.singletonList(Constants.WITNESS_LETTUCE_5X_METHOD);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,26 @@

package org.apache.skywalking.apm.plugin.lettuce.v5.define;

import java.util.Collections;
import java.util.List;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;

import java.util.List;
import org.apache.skywalking.apm.plugin.lettuce.v5.constant.Constants;

import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch;

/**
* The writeAndFlush method is used in versions lower than 5.0.2.RELEASE
*/
public class RedisChannelWriterInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
public class RedisChannelWriterInstrumentationV5 extends ClassInstanceMethodsEnhancePluginDefine {

private static final String ENHANCE_CLASS = "io.lettuce.core.RedisChannelWriter";

private static final String REDIS_CHANNEL_WRITER_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.lettuce.v5.RedisChannelWriterInterceptor";
private static final String REDIS_CHANNEL_WRITER_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.lettuce.v5.RedisChannelWriterInterceptorV5";

@Override
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
Expand All @@ -47,12 +46,12 @@ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {

@Override
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[]{
return new InstanceMethodsInterceptPoint[] {
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("write").and(takesArgument(0, named("io.lettuce.core.protocol.RedisCommand")).or(
takesArgument(0, List.class)));
takesArgument(0, List.class)));
}

@Override
Expand All @@ -65,11 +64,16 @@ public boolean isOverrideArgs() {
return false;
}
},
};
};
}

@Override
public ClassMatch enhanceClass() {
return byHierarchyMatch(ENHANCE_CLASS);
}

@Override
protected List<WitnessMethod> witnessMethods() {
return Collections.singletonList(Constants.WITNESS_LETTUCE_5X_METHOD);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.skywalking.apm.plugin.lettuce.v5.define;

import java.util.Collections;
import java.util.List;
import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
import org.apache.skywalking.apm.plugin.lettuce.common.define.RedisCommandInstrumentation;
import org.apache.skywalking.apm.plugin.lettuce.v5.constant.Constants;

public class RedisCommandInstrumentationV5 extends RedisCommandInstrumentation {

@Override
protected List<WitnessMethod> witnessMethods() {
return Collections.singletonList(Constants.WITNESS_LETTUCE_5X_METHOD);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.DefaultEndpointInstrumentation
lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.RedisChannelWriterInstrumentation
lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.RedisCommandInstrumentation
lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.DefaultEndpointInstrumentationV5
lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.RedisChannelWriterInstrumentationV5
lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.RedisCommandInstrumentationV5
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.skywalking</groupId>
<artifactId>lettuce-plugins</artifactId>
<version>9.5.0-SNAPSHOT</version>
</parent>
<artifactId>apm-lettuce-6.5.x-plugin</artifactId>

<packaging>jar</packaging>

<name>lettuce-6.5.x-plugin</name>

<properties>
<lettuce-core.version>6.5.0.RELEASE</lettuce-core.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-lettuce-common</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>${lettuce-core.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.skywalking.apm.plugin.lettuce.v65;

import io.lettuce.core.protocol.ProtocolKeyword;
import org.apache.skywalking.apm.plugin.lettuce.common.RedisChannelWriterInterceptor;

public class RedisChannelWriterInterceptorV6 extends RedisChannelWriterInterceptor {
@Override
protected String getCommandName(final ProtocolKeyword protocol) {
return protocol.toString();
}
}
Loading
Loading