Aaron Lindsey created GEODE-7184: ------------------------------------ Summary: Add function executions timer Key: GEODE-7184 URL: https://issues.apache.org/jira/browse/GEODE-7184 Project: Geode Issue Type: Improvement Reporter: Aaron Lindsey
Developers oftentimes deploy their own functions to the system to enable decorator pattern for caching to add information to specific key/value pairs. In doing so, they can introduce bottlenecks into the system where server-side functions can cause issues or make things slower than intended. We want a way that users can view functions that they create, and see what the average execution time looks like. * *Meter Type*: Timer * *Name*: geode.function.executions * *Description*: TBD * *Tags*: <common_tags>, function (getId on function, if DNE present getClass.getname of deployed function), succeeded (true/false) h3. Acceptance Criteria *Meter creation/deletion*: Create meter on function deployment/register, delete on un-deploy/unregister of a function or re-deploy of the same function *Measurement*: On an individual server, start the timer when a **USER** deployed function is invoked, and stop the timer when the user function completes OR errors. If it throws a Function Execution or another error then the tag function.isSuccessful=false Details on Functions and their execution: [https://gemfire.docs.pivotal.io/97/geode/developing/function_exec/function_execution.html] *Scenario: The timers are created when the function is deployed* Given a user deployed function with ID functionToTime exists on a cluster with 1 locator/1 server And functionToTime has not been triggered Then the server has the following timer: - name: geode.function.executions - tag: id = functionToTime - tag: succeeded = true - count = 0 - totalTime = 0 And the server has the following timer: - name: geode.function.executions - tag: id = functionToTime - tag: succeeded = false - count = 0 - totalTime = 0 *Scenario: Successful singular function execution* Given a user deployed function with ID functionToTime (that waits for 5 seconds) exists on a cluster with 1 locator/1 server When functionToTime is triggered using gfsh command: "execute function --id=functionToTime" And the function completes without error Then the server has the following timer: - name: geode.function.executions - tag: id = functionToTime - tag: succeeded = true - count = 1 - totalTime >= 5,000,000,000ns *Scenario: Singular function execution with Any Exception* Given a user deployed function with ID functionToTime exists on a cluster with 1 locator /1 server When that function execution is triggered using gfsh command: "execute function --id=functionToTime" And the function exits with a Any exception error after running for 5 seconds Then the server has the following timer: - name: geode.function.executions - tag: id = functionToTime - tag: succeeded = false - count = 1 - totalTime >= 5,000,000,000ns *Scenario: Function execution on multi-servers* Given a user deployed function with ID functionToTime (that waits for 5 seconds) is deployed with 'onRegion' to a replicate region named RR1 And exists on both servers of a cluster with 1 locator (named L1) as well as 2 servers (named S1,S2) When that function execution is triggered against that replicate region using gfsh command: "execute function --id=functionToTime --region=RR1" Then one server has the following timer: - name: geode.function.executions - tag: id = functionToTime - tag: succeeded = true - count = 1 - totalTime >= 5,000,000,000ns And the other server has the following timer: - name: geode.cache.function.executions - tag: id = functionToTime - tag: succeeded = true - count = 0 - totalTime = 0}} *Scenario: Function execution multiple times* Given a user deployed function with ID functionToTime (that waits for 5 seconds) is deployed with 'onRegion' to a replicate region And exists on both servers of a cluster with 1 locator (named L1) as well as 2 servers (named S1,S2) When that function execution is triggered 10 times against that replicate region using gfsh command: "execute function --id=functionToTime --region=RR1 --members=S1" Then S1 has the following timer: - name: geode.function.executions - tag:id = functionToTime - tag:succeeded = true - count = 10 And S2 has the following timer: - name: geode.cache.function.executions - tag:id = functionToTime - tag:succeeded = true - count = 0 *Scenario: The timers are deleted when the function is undeployed* Given a user deployed function with ID functionToTime exists on a cluster with 1 locator/1 server When the user undeploys the function by `undeploy --jar=<tbd>.jar` Then the server does not have any timer with the following name and tag: - name: geode.function.executions - tag: id = functionToTime *Scenario: Non-user deployed functions shouldn't count* Given a cluster with 1 locator/1 server When the system starts up the cache with internal functions Then the server does not have any timer with the following name: - name: geode.function.executions -- This message was sent by Atlassian Jira (v8.3.2#803003)