web stats
clear statistics every day morning - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2015, 09:56 AM
nreddy nreddy is offline
OBX.2 Kenobi
 
Join Date: Jan 2015
Posts: 72
nreddy is on a distinguished road
Default clear statistics every day morning

Hi,
How to clear statistics on dashboard very day morning without doing it manually.


Thanks.
Reply With Quote
  #2  
Old 02-05-2015, 09:57 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

You can create a JavaScript Reader that polls every day at a specific time, then call ChannelUtil to reset the stats for a particular channel.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 02-05-2015, 10:10 AM
nreddy nreddy is offline
OBX.2 Kenobi
 
Join Date: Jan 2015
Posts: 72
nreddy is on a distinguished road
Default

I need to clear statistics for all the channels.
Reply With Quote
  #4  
Old 02-05-2015, 10:28 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by nreddy View Post
I need to clear statistics for all the channels.
Then you can do the same thing, for every channel. There's not yet anything in ChannelUtil to iterate through all channels, but you could potentially call out to an internal controller to do that. There are examples of how to do that on these forums.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #5  
Old 02-05-2015, 10:56 AM
nreddy nreddy is offline
OBX.2 Kenobi
 
Join Date: Jan 2015
Posts: 72
nreddy is on a distinguished road
Default can anyone post sample javascript to clear statistics very day

hi,
can anyone post sample javascript to clear statistics very day.


Thanks.
Reply With Quote
  #6  
Old 02-09-2015, 10:48 AM
nreddy nreddy is offline
OBX.2 Kenobi
 
Join Date: Jan 2015
Posts: 72
nreddy is on a distinguished road
Default

version:-3.1.1.6456
I am using the following code in the channel destination:

var outsams = '231752b8-b129-4b8e-910e-ff0975afbf48';
var cstate = ChannelUtil.getChannelState(outsams).toString();
ChannelUtil.clearStatistics(outsams);

but iam getting the following error.

please help me with this, am i using the functions properly, if not please correct me.



[2015-02-09 12:40:57,787] ERROR (com.mirth.connect.connectors.js.JavaScriptDispatc her:175): Error evaluating JavaScript Writer (JavaScript Writer "reset channel stats" on channel 0e9350ae-5be1-4af3-8c06-aec1ccee5d6d).
com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
reset channel statsCONNECTOR:
reset channel statsSCRIPT SOURCE:
JavaScript WriterSOURCE CODE:
519: }520: }521: function doScript() {522: var outsams = '231752b8-b129-4b8e-910e-ff0975afbf48';523: var cstate = ChannelUtil.getChannelState(outsams).toString();52 4: ChannelUtil.clearStatistics(outsams);525: 526: 527: 528: LINE NUMBER:
524DETAILS:
Java class "com.mirth.connect.server.userutil.ChannelUtil " has no public instance field or method named "clearStatistics".
at de8f1bb1-7ed8-4846-99fb-3f913c306c6e:524 (doScript)
at de8f1bb1-7ed8-4846-99fb-3f913c306c6e:533
at com.mirth.connect.connectors.js.JavaScriptDispatch er$JavaScriptDispatcherTask.call(JavaScriptDispatc her.java:166)
at com.mirth.connect.connectors.js.JavaScriptDispatch er$JavaScriptDispatcherTask.call(JavaScriptDispatc her.java:105)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Reply With Quote
  #7  
Old 02-09-2015, 10:55 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,299
cory_cole is on a distinguished road
Default

It is resetStatistics. This may help, it is towards the bottom....


http://www.mirthcorp.com/community/f...il.java?r=7528
Reply With Quote
  #8  
Old 02-09-2015, 10:57 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Also, use the User API. There's a link to it in the right-click context menu in code editors. There's even a link to it always visible in the Other section of the left-hand task pane. We also host it publicly: http://javadocs.mirthcorp.com/connect/3.1.1/user-api/

ChannelUtil.resetStatistics(channelIdOrName)
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #9  
Old 02-23-2015, 06:22 AM
nreddy nreddy is offline
OBX.2 Kenobi
 
Join Date: Jan 2015
Posts: 72
nreddy is on a distinguished road
Default

Hi i am using channelutil class in version 3.0.0.6931 and i am getting folling error.

Quote:
[2015-02-23 08:17:18,407] ERROR (com.mirth.connect.connectors.js.JavaScriptReceive r:90): Error executing JavaScript Reader script a18568ea-e1b5-44ea-bb17-195d0acd6c0f.
com.mirth.connect.server.util.javascript.JavaScrip tExecutorException: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
clearCONNECTOR:
SourceSOURCE CODE:
520: //statsController.decrementReceivedCount('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');521: 522: 523: //ChannelUtil.clearStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa')524: 525: ChannelUtil.resetStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');526: return; 527: }LINE NUMBER:
525DETAILS:
Java class "com.mirth.connect.server.userutil.ChannelUtil " has no public instance field or method named "resetStatistics".
at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:525 (doScript)
at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:528
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.execute(JavaScriptUtil.java:62)
at com.mirth.connect.connectors.js.JavaScriptReceiver .poll(JavaScriptReceiver.java:88)
at com.mirth.connect.donkey.server.channel.PollConnec tor$PollConnectorTask.run(PollConnector.java:125)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
clearCONNECTOR:
SourceSOURCE CODE:
520: //statsController.decrementReceivedCount('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');521: 522: 523: //ChannelUtil.clearStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa')524: 525: ChannelUtil.resetStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');526: return; 527: }LINE NUMBER:
525DETAILS:
Java class "com.mirth.connect.server.userutil.ChannelUtil " has no public instance field or method named "resetStatistics".
at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:525 (doScript)
at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:528
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:490)
at com.mirth.connect.connectors.js.JavaScriptReceiver $JavaScriptReceiverTask.call(JavaScriptReceiver.ja va:113)
at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Reply With Quote
  #10  
Old 02-23-2015, 07:17 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

The reset statistics methods were added in 3.1.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation