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

Backport Redis instrumentation to SB-1.x #193

Merged

Conversation

pavolloffay
Copy link
Contributor

Resolves #69

At the moment it's blocked by opentracing-contrib/java-redis-client#28. The redis instrumentation fails on SB 1.x.

@malafeev any workarounds are appreciated.

lainekendall and others added 2 commits January 16, 2019 17:51
…b#177)

* Make JDBC tracer configurable through Spring properties

Add properties for "withActiveSpanOnly" and "ignoreStatement" so
the behaviour of the JDBC tracer can be controlled through
application.yaml

* Formatting fixes

Fix indentation and licences headers on new test classes.

* Fix pom ordering

* Rename package, fix tests

* Add default test, document properties

* Revert "Add default test, document properties"

This reverts commit bdbf55a.

* Add Default test

* Add documentation for new properties

* Revert "Add documentation for new properties"

This reverts commit 5274ddb.

* Revert "Add Default test"

This reverts commit 1a72821.

* Revert "Revert "Add documentation for new properties""

This reverts commit 47353f2.

* Add identical test

* Empty out test

* Add empty test

* Delete defaults test
* [issue-69] Redis instrumentation

* [issue-69] PR changes

* [issue-69] Fix dependecies
@malafeev
Copy link

@pavolloffay workaround is to use opentracing-redis-spring 0.0.7

@pavolloffay
Copy link
Contributor Author

@malafeev with 0.0.7 I get the same error. The 0.0.7 uses SB 2 not 1.x https://github.com/opentracing-contrib/java-redis-client/blob/0.0.7/opentracing-redis-spring/pom.xml#L30

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.201 sec <<< FAILURE!
commandCreatesNewSpan(io.opentracing.contrib.spring.cloud.redis.IntegrationTest)  Time elapsed: 0.088 sec  <<< ERROR!
java.lang.AbstractMethodError: io.opentracing.contrib.redis.spring.connection.TracingRedisConnection.set([B[B)V
	at org.springframework.data.redis.core.DefaultValueOperations$10.inRedis(DefaultValueOperations.java:172)
	at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:57)
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:207)
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169)
	at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:91)
	at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:169)
	at io.opentracing.contrib.spring.cloud.redis.IntegrationTest.commandCreatesNewSpan(IntegrationTest.java:93)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

2019-01-17 10:33:59.185  INFO 9695 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@2de23121: startup date [Thu Jan 17 10:33:57 CET 2019]; root of context hierarchy

Results :

Tests in error: 
  commandCreatesNewSpan(io.opentracing.contrib.spring.cloud.redis.IntegrationTest): io.opentracing.contrib.redis.spring.connection.TracingRedisConnection.set([B[B)V
``

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@malafeev
Copy link

Looks like solution is only to add support of sping-boot 1.5x to opentracing-redis-spring.
Should we create special branch for spring-boot 1.5 and release only opentracing-redis-spring with some special version?

@pavolloffay
Copy link
Contributor Author

Should we create special branch for spring-boot 1.5 and release only opentracing-redis-spring with some special version?

Or create a submodule in master branch - as you prefer.

@malafeev
Copy link

I'm not sure what's the best.
If we will create submodule then we will support it (it will be released with all other modules each release).

@pavolloffay
Copy link
Contributor Author

Well the plan is to support it. For me it's easier to support it as module than go to a separate branch

@pavolloffay
Copy link
Contributor Author

@malafeev ping me when the artifact is out please.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
redisTemplate.opsForValue().set(100L, "Some value here");
assertEquals(1, tracer.finishedSpans().size());
// TODO it's null here, but in SB 2.x it works
// assertEquals("SET", tracer.finishedSpans().get(0).tags().get("command"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@malafeev why the command is not set when using opentracing-redis-spring-data? I get this regression when compared to SB 2

Copy link

@malafeev malafeev Jan 23, 2019

Choose a reason for hiding this comment

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

command is an operationName now, do we need to duplicate tag?

currentTracer.buildSpan(command)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need for duplication. Has it also changed in the instrumentation for SB 2.x?

Choose a reason for hiding this comment

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

yes

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay pavolloffay changed the title WIP: Backport Redis instrumentation to SB-1.x Backport Redis instrumentation to SB-1.x Jan 23, 2019
@pavolloffay pavolloffay merged commit a81ceb7 into opentracing-contrib:SB-1.x Jan 23, 2019
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.

None yet

3 participants