Sidehistorik
...
Kodeblok | ||||
---|---|---|---|---|
| ||||
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.event.events.content.page.*
import groovy.transform.Field
import com.timgroup.statsd.StatsDClient;
import com.timgroup.statsd.NonBlockingStatsDClient;
def spaceManager = ComponentLocator.getComponent(SpaceManager)
def pageManager = ComponentLocator.getComponent(PageManager)
String userName="Anonymous"
def currentUser = AuthenticatedUserThreadLocal.get()
if (currentUser)
{
userName=(String)currentUser.name
}
//System.out.println("Start...")
def event = event as PageEvent
def spaceKey = event.page.spaceKey
def pageId = event.page.id as String
//System.out.println("Posting.....")
String[] tags = ["user:${userName}", "space:${spaceKey}", "user:${pageId}"]
StatsDClient statsdpage = new NonBlockingStatsDClient("confluence.stats.views","localhost",8125,tags);
statsdpage.incrementCounter("page");
try
{
//System.out.println("Closing socket");
statsdpage.stop();
}
catch(Exception ex) {
//System.out.println("Catching the exception");
}
//System.out.println("End......") |
...