-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
jooby-apt: turn off Route.setReturnType by default and mark as deprecated #3529
Comments
Why not always do it? Performance? (I can’t see how but maybe) |
Output looks clean/readable but also came from #3525 which makes javac to hang/fail not sure why bc jooby-apt generates valid code (probably method size but not sure). Finally you requested this change I doubt anyone else uses it :D |
IIRC there was someone else but perhaps I'm misremembering. Given the uptake of Open Telemetry and other metrics what do you recommend for applying metrics on a per request endpoint? Perhaps the normal one off Jooby projects don't have this need but we have like 20 different Jooby services. Our original use case was for metrics and logging. Without a ton of boilerplate would be introduced or some sort of heuristic to figure it out based on the route which is precisely what the route logic does. I'm not going to lie this will be a very painful change for us even if it is configurable. We were not using Maven's annotation processor path and that is the only option if you use compiler flags. It is one of the reasons why I made almost all of JStachio config annotation driven: https://jstach.io/doc/jstachio/current/apidocs/#configuration (pick up the option via a module-info.java / package-info.java annotation). The problem is that Maven annotation processor path setting has lots of issues. You have to put the version of the "apt" module every time (it ignores As for the attributes that seems independent of this. If I am the only one using this feature (and I swore I have seen others ask about it) than we should remove it. I will then I guess have to rely on byte code weaving or something aka use the OTEL javaagent which is not desirable. I don't like Java agents but if that is the only way to get class and method name metrics I suppose that is what I will have to do. |
The other option BTW is just to actually set the EDIT: What I mean is that it is Graal VM native friendly if you statically get access to the reflection Method. That is generate code that does: // Graal does not mind reflection if you use literals to get access.
route.setReflectMethod(ExampleController.class.getDeclaredMethod("index", String.class)); Then to get annotations one can just do |
Route attributes is a bridge between the two models lambda vs mvc. Route attributes don't rely on reflection and all the effort on the new jooby-apt processor (including this one) is to reduce/remove reflection. Nothing on jooby (today) rely on method or return type The feature is still there, just need to be enabled. |
Yes but I'm concerned. Every time you make an option it adds complexity (e.g. an With the change you are breaking things (which I get for the better of the project you have to), you have to add more work for documenting the option, and you have to add specific code to check if the flag is there. I just fail to see why someone would want to disable this. Honestly I seriously doubt the Java compiler is hanging because of generating code for that (and even for attributes). There is no way it is method size. I know this because I have templating library that generates the entire rendering logic in a single method. It takes a lot to exceed the limit. So we should figure that out first.
Yes ideally I would prefer the static stuff you do with attributes as you are right about that. It was unclear if that was getting removed or flagged as well because of to many attributes. EDIT I don't need the actual reflective method. I just need its name and signature. It can be a String of some format. If we put that in it will work for my metric needs. I can't do this with the normal annotation attributes otherwise I have to copy the method name into some annotation. |
@jknack what I'm getting at is maybe we just remove the To be honest I forgot that MvcMethod.of(Class<?>, "methodName", Param1.class, Param2.class....) This would avoid the lookup on registration. Then maybe |
Given:
Generates:
These two option are now controlled by processor options:
jooby.mvcMethod
andjooby.returnType
starting on next release these two options will be off by default (false
). So output will be just:/cc @agentgt @kliushnichenko
The text was updated successfully, but these errors were encountered: