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

#859 fix inherited timed annotation #861

Conversation

mtakaki
Copy link

@mtakaki mtakaki commented Sep 1, 2015

Suggestion for fixing the the issue #859 that prevented having resources inheriting annotated methods.
Also fixing the support for absolute metric names that apparently was not working properly.

… using @timed, @metered, and @ExceptionMetered by using the handler class and method name when registering the methods.
@rferreira
Copy link

hey folks what's the good word on this PR?

@mtakaki
Copy link
Author

mtakaki commented Oct 4, 2015

I haven't heard anything regarding my proposed fix for this issue, @rferreira. My suggestion at #746 is still valid. You can import this fix into your project at any time. To make it easier, just add this file: https://raw.githubusercontent.com/mtakaki/metrics/mtakaki_746_fix_inherited_timed_annotation/metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/InstrumentedResourceMethodApplicationListener.java

@edwardsb
Copy link

edwardsb commented Jan 6, 2016

@mtakaki I did as you suggested, and got

java.lang.NoSuchMethodException: Could not find a suitable constructor in com.mywebservice.InstrumentedResourceMethodApplicationListener class.

@mtakaki
Copy link
Author

mtakaki commented Jan 7, 2016

@edwardsb which version of dropwizard are you using? I noticed it didn't work as soon as I migrated from 0.8.x to 0.9.x. So I had to do some changes to it: https://gist.github.com/mtakaki/746dba30edfefc0ffbd5

To be honest, I completely gave up about having my fix merged. So this has been my current approach to get around this issue.

@edwardsb
Copy link

edwardsb commented Jan 7, 2016

I am using 0.9.x.

I copied your gist in and its no longer throwing the suitable constructor error.

Though I am now getting null pointers on exception metered methods of sub-resources. For some reason my top level resources that have @timed, @metered, and @ExeptionMetered are getting registered on startup, but sub-resource still don't look like they are in the maps of timers, meters, and exception meters.

Ultimately this line is called:
final ExceptionMeterMetric metric = this.exceptionMeters.get(chooseName(annotation.name(), annotation.absolute(), handlerClass, definitionMethod));

and since there is nothing in the map with that key, metric is null and then we call a method on it.

Do you register your sub-resources with the Jersey environment? I tried that too and it wasn't working.

@ryantenney
Copy link
Contributor

@mtakaki I appreciate the fix, and it will be merged, but not into 3.1. It'd be perfect for 3.2, but I'm trying to focus on v4, and you can expect the fix to be included there.

@mtakaki
Copy link
Author

mtakaki commented Jan 7, 2016

@edwardsb I'll take a look tonight. So you have two resources, a parent and a child, and both are being used as resources? I'll try this later today, but I don't see why it would not work. And yes, you need to register all the concrete resource classes.

@ryantenney sorry, I didn't know you were too busy to look at my PR. Thanks for working on the version 4 :) Really appreciate the good work you're doing with the metrics project.

@edwardsb
Copy link

edwardsb commented Jan 7, 2016

@mtakaki Yes here is a gist of what I am working with: https://gist.github.com/edwardsb/0a8d232c66bf54f0b75a

Thanks for the help. Do you mind if I message you on twitter?

@mtakaki
Copy link
Author

mtakaki commented Jan 7, 2016

@edwardsb not at all. Feel free to message me on twitter.

@leeavital
Copy link

This is something we would find useful as well. I'd be glad to help in any way :)

@jplock jplock modified the milestone: 3.1.3 Jul 12, 2016
@rkalicinski
Copy link

Is it possible to merge those commits?

@github-actions
Copy link

github-actions bot commented Sep 6, 2019

This pull request is stale because it has been open 180 days with no activity. Remove the "stale" label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Sep 6, 2019
@github-actions github-actions bot closed this Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants