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

New feature provided : new plugin for influxdb-java client #4846

Merged
merged 39 commits into from
Jun 21, 2020

Conversation

dagmom
Copy link
Contributor

@dagmom dagmom commented May 31, 2020

Please answer these questions before submitting pull request

  • Why submit this pull request?
  • New feature provided

add new java sdk plugin : InfluxDB

  • i develop a new plugin for influxdb-java client
  • i‘ve done the unit test and access influxdb can display on the topology and trace history

20200531172711

20200531172606

20200531172643

@codecov
Copy link

codecov bot commented May 31, 2020

Codecov Report

Merging #4846 into master will decrease coverage by 0.25%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4846      +/-   ##
============================================
- Coverage     50.22%   49.97%   -0.26%     
+ Complexity     2751     2737      -14     
============================================
  Files           763      763              
  Lines         18872    18875       +3     
  Branches       1851     1851              
============================================
- Hits           9478     9432      -46     
- Misses         8635     8687      +52     
+ Partials        759      756       -3     
Impacted Files Coverage Δ Complexity Δ
.../apache/skywalking/apm/agent/core/conf/Config.java 47.05% <0.00%> (-1.14%) 0.00 <0.00> (ø)
.../apm/network/trace/component/ComponentsDefine.java 98.59% <100.00%> (+0.02%) 1.00 <0.00> (ø)
.../core/logging/core/coverts/ThrowableConverter.java 18.18% <0.00%> (-63.64%) 2.00% <0.00%> (-2.00%)
...r/cluster/plugin/standalone/StandaloneManager.java 80.00% <0.00%> (-20.00%) 3.00% <0.00%> (-1.00%)
.../server/storage/plugin/jdbc/h2/dao/H2BatchDAO.java 64.10% <0.00%> (-10.26%) 5.00% <0.00%> (ø%)
...alking/apm/agent/core/commands/CommandService.java 26.08% <0.00%> (-8.70%) 7.00% <0.00%> (-1.00%)
...ache/skywalking/apm/agent/core/jvm/JVMService.java 74.57% <0.00%> (-8.48%) 6.00% <0.00%> (-1.00%)
...erver/library/server/grpc/CustomThreadFactory.java 69.23% <0.00%> (-7.70%) 2.00% <0.00%> (-1.00%)
...pm/agent/core/commands/CommandExecutorService.java 46.15% <0.00%> (-7.70%) 4.00% <0.00%> (-1.00%)
.../skywalking/apm/agent/core/remote/GRPCChannel.java 80.64% <0.00%> (-6.46%) 5.00% <0.00%> (-1.00%)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8648f0d...03ac123. Read the comment docs.

@kezhenxu94 kezhenxu94 added agent Language agent related. plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. labels May 31, 2020
@kezhenxu94
Copy link
Member

@dagmom please add the InfluxDB logo/icon to http://github.com/apache/skywalking-rocketbot-ui

@dmsolr
Copy link
Member

dmsolr commented May 31, 2020

Thanks! The plugin-test is required. :)

@wu-sheng
Copy link
Member

@dagmom
Copy link
Contributor Author

dagmom commented Jun 2, 2020

@dagmom Read this doc, https://github.com/apache/skywalking/blob/master/docs/en/guides/Plugin-test.md, and you could find many test cases in our repo, https://github.com/apache/skywalking/tree/master/test/plugin/scenarios

ok , I've read the doc.
I need to spend some time on it
and will finish the plugin-test as soon as possible

@wu-sheng wu-sheng requested a review from arugal June 3, 2020 15:04
@wu-sheng
Copy link
Member

wu-sheng commented Jun 3, 2020

Hi, I will be on vacation for next three days. Feel free to review this PR, and other PRs. Just be carefully, we are closing the 8.0 release.
@dmsolr @kezhenxu94 @arugal

@arugal
Copy link
Member

arugal commented Jun 4, 2020

@dagmom rat check failed, please recheck.

@kezhenxu94
Copy link
Member

@dagmom there is TODO in the new codes, when it's ready, please ping us

@dagmom
Copy link
Contributor Author

dagmom commented Jun 6, 2020

@dagmom there is TODO in the new codes, when it's ready, please ping us

  1. The first step ,I completed found influxDB as a component.
  2. I left the TODO in order to complete the ‘db statement’ content later.
    Can you merge the PR first, The second point will be completed later

Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

Some review comments should be addressed before merging, and please rebase your branch on the latest master branch since your branch is out of date

Comment on lines 30 to 31
<artifactId>apm-influxdb-2.x-plugin</artifactId>
<description>This plugin is for use with InfluxDB 1.x.</description>
Copy link
Member

Choose a reason for hiding this comment

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

The artifactId and the description don't match, one says it's for 2.x while the other says it's for 1.x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

apm-influxdb-2.x-plugin means influxdb client lib version
This plugin is for use with InfluxDB 1.x. means influxdb version , then i'll change to client version

Comment on lines 33 to 36
* enhance InfluxDB InfluxDBFactory
* really impl class {@link org.influxdb.impl.InfluxDBImpl}
*
* @since 2020/05/22
Copy link
Member

Choose a reason for hiding this comment

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

Capitalize the first letter of the sentence please

Copy link
Member

Choose a reason for hiding this comment

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

What does since date mean? Quiet unusual, from my understanding. We coulf know when be added through git log directly

Copy link
Member

Choose a reason for hiding this comment

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

What does since date mean? Quiet unusual, from my understanding. We coulf know when be added through git log directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,I'll removesince


private static final String ENHANCE_CLASS = "org.influxdb.impl.InfluxDBImpl";
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.influxdb.interceptor.InfluxDBConstructorInterceptor";
private static final String INFLUXDB_METHOD_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.influxdb.interceptor.InfluxDBMethodInterceptor";
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
private static final String INFLUXDB_METHOD_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.influxdb.interceptor.InfluxDBMethodInterceptor";
private static final String INFLUXDB_METHOD_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.influxdb.interceptor.InfluxDBMethodInterceptor";

assertThat(SpanHelper.getComponentId(span), is(ComponentsDefine.INFLUXDB_JAVA.getId()));
List<TagValuePair> tags = SpanHelper.getTags(span);
assertThat(tags.get(0).getValue(), is("InfluxDB"));
// assertThat(tags.get(1).getValue(), is("write ".concat(allArgument[0].toString())));
Copy link
Member

Choose a reason for hiding this comment

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

Remove if useless, or fix it if assertion is failed

Comment on lines 29 to 32
* InfluxDBExecutor
*
* @author guhao
* @since 2020/6/3
Copy link
Member

Choose a reason for hiding this comment

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

Remove author tag

Comment on lines 21 to 37
/**
* InfluxDBExecutorTest
*
* @author guhao
* @since 2020/6/3
*/
public class InfluxDBExecutorTest {

// @Test
// public void testPing(){
// InfluxDBExecutor executor = new InfluxDBExecutor("http://localhost:8086");
// Pong pong = executor.ping();
// System.out.println(pong.getVersion());
// Assert.assertNotNull(pong.getVersion());
// }

}
Copy link
Member

Choose a reason for hiding this comment

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

Remove this if it's useless

new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return InfluxDBMethodMatch.INSTANCE.getInfluxDBMethodMatcher();
Copy link
Member

Choose a reason for hiding this comment

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

This is good for encapsulation, but it's a pitfall that we check third-party classes in classes whose name end with *Instrumentation

<module name="ImportControl">
<property name="file" value="${import.control}"/>
<property name="path" value="apm-sniffer/(apm-sdk-plugin|bootstrap-plugins|optional-plugins)/.+/src/main/.+Instrumentation.java$"/>
</module>
<module name="ImportControl">
<property name="file" value="${import.control}"/>
<property name="path" value="apm-sniffer/apm-toolkit-activation/.+/src/main/.+Activation.java$"/>

to avoid issues like this #2871 , but this breaks the checks, although there is no third-party class in the InfluxDBMethodMatch for now, other reviewers should pay attention to this class in the future, FYI @wu-sheng

Copy link
Member

Choose a reason for hiding this comment

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

Question, why need this singleton. This method is not called in high frequently, and nothing cached there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did it the other way

@wu-sheng
Copy link
Member

This is what I mean submodule unexpected update.

image

Please make sure the submodule commit id is as same as the master branch.

wu-sheng
wu-sheng previously approved these changes Jun 20, 2020
@wu-sheng
Copy link
Member

Another Quasar plugin got merged first, so, please change the component id, #4951. And update the codes.

# Conflicts:
#	apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
#	oap-server/server-bootstrap/src/main/resources/component-libraries.yml
#	oap-server/server-core/src/test/resources/component-libraries.yml
Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

Agent setup document, Table of Agent Configuration Properties should be updated as you could collect parameters. And this feature should be tested plugin test tool, I haven't seen the parameters in the tags for now.

@dagmom
Copy link
Contributor Author

dagmom commented Jun 21, 2020

Agent setup document, Table of Agent Configuration Properties should be updated as you could collect parameters. And this feature should be tested plugin test tool, I haven't seen the parameters in the tags for now.

@wu-sheng As i known, influxdb-java is unlike jdbc api, it has no parameters.

Just use Query,Point and lineprotocol , none of these use parameters

@wu-sheng
Copy link
Member

If just influxql, why need a config item?

@dagmom
Copy link
Contributor Author

dagmom commented Jun 21, 2020

If just influxql, why need a config item?

@wu-sheng I looked at other plugins, like plugin.elasticsearch.trace_dsl.
Maybe just want to show component in some scenarios.

@wu-sheng
Copy link
Member

OK. Your test case and CI fails somehow, please fix them.

@dagmom
Copy link
Contributor Author

dagmom commented Jun 21, 2020

image

@dmsolr @wu-sheng
This time it seems to be VM crash, can you rerun CI ?

Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

Merged your other PR, but this PR still doesn't allow me to update automatically(you closed that option). Please update the branch.

@@ -78,3 +78,6 @@ logging.level=${SW_LOGGING_LEVEL:INFO}

# mysql plugin configuration
# plugin.mysql.trace_sql_parameters=${SW_MYSQL_TRACE_SQL_PARAMETERS:false}

# influxdb plugin configuration
# plugin.influxdb.trace_influxql=${SW_INFLUXDB_TRACE_INFLUXQL:true}
Copy link
Member

Choose a reason for hiding this comment

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

This is not a widely used config, don't need to add it into the default agent.config. Putting it in the document should be enough.

@dagmom
Copy link
Contributor Author

dagmom commented Jun 21, 2020

Merged your other PR, but this PR still doesn't allow me to update automatically(you closed that option). Please update the branch.

@wu-sheng Where is this option? I can't find it, or invite to this fork repository

@wu-sheng
Copy link
Member

I think at the PR page, there is a selector to provide upstream repo owner to edit your fork repo or branch. I can't see this at my side.

@wu-sheng wu-sheng added this to the 8.1.0 milestone Jun 21, 2020
@wu-sheng wu-sheng added the feature New feature label Jun 21, 2020
@wu-sheng wu-sheng merged commit 08897ce into apache:master Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent Language agent related. feature New feature plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants