How to display metrics using Ducksboard in grails

Posted By : Tushar Paliwal | 13-Jun-2015

In this blog i will explain how can we manage our project statistics online using custom widget. It provides online dashboard to display all metrics in real time. It supports a lots of services like Google Analitics, Feedburner, Twilio, MailChimp and many others.

  • Introduction

Ducksboard allows users to track their web metrics and produce analysis and reports based on the metrics. The Ducksboard API allows developers to access and integrate the functionality of Ducksboard with other applications.

It simply provides us pull, push api's which helps us to manage data online and shows using various type of widgets.

  • Push API

The push API allows sending data to ducksboard and widget is used to display that data that data. Each push API call simply stores data in a datasource called label. We can find this label from either dashboard or using URL of push api. There are different format of data used by different kinds of widget.

  • Pull API

The pull API is used to retrieve data associated with particular datasource i.e. Label we just need to provide label to which we want to retrieve the data, the data pulled are of dfferent format based upon label.

 

Integration of Ducksboard with grails

  • Step 1 :

We just need to create API key which is provided by ducksboard after creating account at ducksboard.

  • Step 2 :

Now put an entry in BuildConfig.groovy file.


dependencies {
  
         compile ":ducksboard-api:0.4.0"

    }

 

 

  • Step 3 :

Now put an entry in Config.groovy file.


ducksboard {
    user = "YOUR-USER-API-KEY"
    password = "NOT-USED"
}

Right now its is not mendatory to put password in configuration but this can be used in future by there API.

 

  • Step 4 :

There are many pull, push methods are used for displaying data in different type of widgets.

For Example :

  • To pull and push data for Counters, Bar, Boxes, Pins widget we can use:


ducksboardService.pullLongValue(String widgetId)
ducksboardService.pushLongValue(String widgetId, Long value)

We can also update data of above mentioned widgets using :


ducksboardService.pushLongDelta(String widgetId, Long delta = 1)
  • To push data for Graph(Interval of time) widget, we can use:


ducksboardService.pushTimestampValues(String widgetId, List timestamps, List values)
  • To push data for Leaderboard, Trend-Leaderboard widget, we can use:


ducksboardService.pushLeaderboardValues(String widgetId, List names, List values)

I hope this will be meaningful for you, feel free to ask any query.

 

 

About Author

Author Image
Tushar Paliwal

Tushar is a developer with experience in Groovy and Grails , Spring and enterprise Java Technologies.

Request for Proposal

Name is required

Comment is required

Sending message..