Ah, *that* works brilliantly, thanks :). For future people stumbling upon this thread: If you get a ClassCastException—the property needs to be set as a string, not a number.
- hugi > On 13. sep. 2016, at 19:08, John Huss <[email protected]> wrote: > > Sorry, you're right. I posted the wrong property. It should be this one > > Constants.QUERY_EXECUTION_TIME_LOGGING_THRESHOLD_PROPERTY > > > > On Tue, Sep 13, 2016 at 1:47 PM Andrus Adamchik <[email protected]> > wrote: > >> JDBC_MAX_QUEUE_WAIT_TIME is the max time to wait for connections from >> connection pool, so it wouldn't cancel long-running queries or anything. >> >> From Hugi's description, all the EOF feature does is conditionally output >> some logs on slower queries. While I'd handle that in a UNIX way by >> attaching some external watch script to the logs, there's certainly a >> Cayenne way for dealing with this too by binding a custom JdbcEventLogger >> in DI (decorate JdbcEventLogger or subclass CommonsJdbcEventLogger) and >> implementing alert logic in overridden 'logSelectCount' method that takes >> query time as a parameter. >> >> (On a side note, I am looking to having a JMX or metrics framework >> integration in Cayenne to be able to gather statistics via in a centralized >> place and let user code to consume it in any way they want). >> >> Andrus >> >> >> >> >>> On Sep 9, 2016, at 10:06 AM, John Huss <[email protected]> wrote: >>> >>> You can set the property in the module when creating your ServerRuntime: >>> >>> new Module() { >>> >>> @Override >>> >>> public void configure(Binder binder) { >>> >>> MapBuilder<Object> props = binder.bindMap(Constants.PROPERTIES_MAP); >>> >>> props.put(Constants.JDBC_MAX_QUEUE_WAIT_TIME, 8000); // 8 seconds >>> >>> } >>> >>> } >>> >>> This only will report AFTER the query finishes, so it not really valuable >>> if your query is really hung for a very long time. But for general >>> slowness it works. >>> >>> >>> >>> On Fri, Sep 9, 2016 at 8:42 AM Hugi Thordarson <[email protected]> wrote: >>> >>>> Hi all, >>>> in EOF we could make the application log a warning if a DB query was >>>> taking more than a specified amount of time to complete. >>>> >>>> Is there any location where I could plug into Cayenne to do something >>>> similar? We’re deploying a reporting system for a large-ish database >> and I >>>> know some queries might be problematic—so I’d like to watch out for >> this as >>>> we deploy. >>>> >>>> Cheers, >>>> - hugi >>>> >>>> // Hugi Thordarson >>>> // http://www.loftfar.is/ >>>> // s. 895-6688 >>>> >>>> >>>> >>>> >> >>
