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

RemoteControlledSampler fails with "No strategy present in response. Not updating sampler." in native mode #10402

Closed
ctron opened this issue Jul 1, 2020 · 12 comments · Fixed by #23610 or #24491
Labels
area/jaeger kind/bug Something isn't working
Milestone

Comments

@ctron
Copy link
Contributor

ctron commented Jul 1, 2020

Describe the bug

When using Jaeger tracing by adding: io.quarkus:quarkus-jaeger, tracing seems to work, but a periodic error message is in the log, when using native mode.

I assume that updating the strategy is broken as well.

Expected behavior

Same as JVM mode: No error message. Update works.

Actual behavior

2020-07-01T11:31:05.711Z ERROR [RemoteControlledSampler] No strategy present in response. Not updating sampler.

To Reproduce
Steps to reproduce the behavior:

  1. Enable tracing
  2. Check the logs

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version:
  • GraalVM version (if different from Java):
  • Quarkus version or git rev:
  • Build tool (ie. output of mvnw --version or gradlew --version):
@ctron ctron added the kind/bug Something isn't working label Jul 1, 2020
@geoand
Copy link
Contributor

geoand commented Jul 8, 2020

cc @pavolloffay

@pavolloffay
Copy link
Contributor

Could you please share what version of Jaeger backed are you using and its configuration?

@ctron
Copy link
Contributor Author

ctron commented Jul 8, 2020

<jaeger-client.version>1.1.0</jaeger-client.version>
<opentracing.version>0.33.0</opentracing.version>

@pavolloffay
Copy link
Contributor

I mean Jaeger backend/server components.

@ctron
Copy link
Contributor Author

ctron commented Jul 8, 2020

image

@calohmn
Copy link

calohmn commented May 21, 2021

This seems caused by the reflection used in conjunction with the io.jaegertracing.internal.samplers.HttpSamplingManager class.
There, a SamplingStrategyResponse object is deserialized from the JSON response using gson, which makes use of reflection to do so. That means a reflection config has to be defined here.

I've gotten it to work with the following config:

  {
    "name" : "io.jaegertracing.internal.samplers.http.OperationSamplingParameters",
    "allDeclaredConstructors" : true,
    "allPublicConstructors" : true,
    "allDeclaredMethods" : true,
    "allPublicMethods" : true,
    "allDeclaredFields" : true,
    "allPublicFields" : true,
    "fields" : [
      { "name" : "defaultSamplingProbability", "allowWrite" : true },
      { "name" : "defaultLowerBoundTracesPerSecond", "allowWrite" : true },
      { "name" : "perOperationStrategies", "allowWrite" : true }
    ]
  },
  {
    "name" : "io.jaegertracing.internal.samplers.http.PerOperationSamplingParameters",
    "allDeclaredConstructors" : true,
    "allPublicConstructors" : true,
    "allDeclaredMethods" : true,
    "allPublicMethods" : true,
    "allDeclaredFields" : true,
    "allPublicFields" : true,
    "fields" : [
      { "name" : "operation", "allowWrite" : true },
      { "name" : "probabilisticSampling", "allowWrite" : true }
    ]
  },
  {
    "name" : "io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy",
    "allDeclaredConstructors" : true,
    "allPublicConstructors" : true,
    "allDeclaredMethods" : true,
    "allPublicMethods" : true,
    "allDeclaredFields" : true,
    "allPublicFields" : true,
    "fields" : [
      { "name" : "samplingRate", "allowWrite" : true }
    ]
  },
  {
    "name" : "io.jaegertracing.internal.samplers.http.RateLimitingSamplingStrategy",
    "allDeclaredConstructors" : true,
    "allPublicConstructors" : true,
    "allDeclaredMethods" : true,
    "allPublicMethods" : true,
    "allDeclaredFields" : true,
    "allPublicFields" : true,
    "fields" : [
      { "name" : "maxTracesPerSecond", "allowWrite" : true }
    ]
  },
  {
    "name" : "io.jaegertracing.internal.samplers.http.SamplingStrategyResponse",
    "allDeclaredConstructors" : true,
    "allPublicConstructors" : true,
    "allDeclaredMethods" : true,
    "allPublicMethods" : true,
    "allDeclaredFields" : true,
    "allPublicFields" : true,
    "fields" : [
      { "name" : "probabilisticSampling", "allowWrite" : true },
      { "name" : "rateLimitingSampling", "allowWrite" : true },
      { "name" : "operationSampling", "allowWrite" : true }
    ]
  }

The allowWrite configuration seems to be needed, since Lombok generates final fields in the above classes.
See the exception otherwise produced:

IllegalAccessException: Cannot set final field: io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy.samplingRate. Enable by specifying "allowWrite" for this field in the reflection configuration.

Having to define such a reflection config in the application using quarkus-jaeger of course doesn't look like a proper solution, so
I guess this should be solved by some other means inside quarkus-jaeger.

@calohmn
Copy link

calohmn commented Jun 2, 2021

Maybe it is caused by not all relevant classes being included here:

public ReflectiveClassBuildItem reflectiveClasses() {
return ReflectiveClassBuildItem
.builder("io.jaegertracing.internal.samplers.http.SamplingStrategyResponse",
"io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy")
.finalFieldsWritable(true)

It seems to me that

"io.jaegertracing.internal.samplers.http.RateLimitingSamplingStrategy",
"io.jaegertracing.internal.samplers.http.PerOperationSamplingParameters",
"io.jaegertracing.internal.samplers.http.OperationSamplingParameters"

are missing here. I haven't yet checked whether adding these here resolves the issue, though.

@jmartisk Any comment on this (the above code was added in 05b5041) ?

@sophokles73
Copy link
Contributor

@objectiser I would like to contribute a PR for adding the missing classes for reflection as pointed out by @calohmn
Which branch should I create the PR for? We are (still) using 2.6.3 so I am inclined to do it against the 2.6 branch. Does that make sense or is 2.6 already dead and we should focus on 2.7 instead?

@geoand
Copy link
Contributor

geoand commented Feb 11, 2022

All PRs go against the main branch.

@sophokles73
Copy link
Contributor

How do you determine which releases the fix will go into. i.e. can I expect the fix to be part of the next 2.6.x or 2.7.x release?

@geoand
Copy link
Contributor

geoand commented Feb 11, 2022

We decide whether or not to backport to live branches based on the impact of the change. As you said, 2.6 is dead now that 2.7 is out, so the question is whether the fix would be backported to 2.7

sophokles73 added a commit to sophokles73/quarkus that referenced this issue Feb 11, 2022
Retrieving sampler configuration from a central Jaeger Collector
requires lookup of additional value object classes. These missing
classes have been registered for reflection.

Fix quarkusio#10402

Signed-off-by: Kai Hudalla <[email protected]>
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Feb 13, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.2.Final Feb 21, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 21, 2022
Retrieving sampler configuration from a central Jaeger Collector
requires lookup of additional value object classes. These missing
classes have been registered for reflection.

Fix quarkusio#10402

Signed-off-by: Kai Hudalla <[email protected]>
(cherry picked from commit dd68b41)
@sophokles73
Copy link
Contributor

Registering the missing Jaeger classes for reflection in the Jaeger extension (#23610) actually is not enough. It seems that access to the classes' fields also needs to be enabled explicitly.

sophokles73 added a commit to sophokles73/quarkus that referenced this issue Mar 23, 2022
The Jaeger client uses GSON to unmarshall JSON messages containing
sampling configuration to Java objects. GSON uses reflection on the DTO
object to determine fields that match the properties in the JSON object.

by default, the ReflectiveClassBuildItem does not allow access to a
class' fields via reflection. This PR therefore explicitly enables it.

This should (finally) fix quarkusio#10402

Signed-off-by: Kai Hudalla <[email protected]>
@gsmet gsmet modified the milestones: 2.7.2.Final, 2.8.0.Final Mar 28, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Mar 28, 2022
The Jaeger client uses GSON to unmarshall JSON messages containing
sampling configuration to Java objects. GSON uses reflection on the DTO
object to determine fields that match the properties in the JSON object.

by default, the ReflectiveClassBuildItem does not allow access to a
class' fields via reflection. This PR therefore explicitly enables it.

This should (finally) fix quarkusio#10402

Signed-off-by: Kai Hudalla <[email protected]>
(cherry picked from commit d6bffc0)
@gsmet gsmet modified the milestones: 2.8.0.Final, 2.7.6.Final May 5, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 5, 2022
The Jaeger client uses GSON to unmarshall JSON messages containing
sampling configuration to Java objects. GSON uses reflection on the DTO
object to determine fields that match the properties in the JSON object.

by default, the ReflectiveClassBuildItem does not allow access to a
class' fields via reflection. This PR therefore explicitly enables it.

This should (finally) fix quarkusio#10402

Signed-off-by: Kai Hudalla <[email protected]>
(cherry picked from commit d6bffc0)
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 5, 2022
The Jaeger client uses GSON to unmarshall JSON messages containing
sampling configuration to Java objects. GSON uses reflection on the DTO
object to determine fields that match the properties in the JSON object.

by default, the ReflectiveClassBuildItem does not allow access to a
class' fields via reflection. This PR therefore explicitly enables it.

This should (finally) fix quarkusio#10402

Signed-off-by: Kai Hudalla <[email protected]>
(cherry picked from commit d6bffc0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jaeger kind/bug Something isn't working
Projects
None yet
6 participants