GithubHelp home page GithubHelp logo

gatling-druid-feeder's Introduction

gatling-druid-feeder

Custom Gatling Feeder voor connecting to a Druid cluster to get info

How to use

There are 2 different ways you can use this feeder

  • With standard case class combined with a conversion method to output the contents of the case class as a Map
  • With a case class which extends the FeedElementBuilder

Example

bare case class with conversion method

import com.godatadriven.gatling.feeder.druid.DruidTimeSeriesQueryFeeder
import ing.wbaa.druid.definitions.{Aggregation, Dimension}
import ing.wbaa.druid.query.TimeSeriesQuery

case class TimeseriesCount(count: Int)

val timeSeriesQuery = TimeSeriesQuery[TimeseriesCount](
    aggregations = List(
      Aggregation(
        kind = "count",
        name = "count",
        fieldName = "count"
      )
    ),
    granularity = "hour",
    intervals = List("2011-06-01/2017-06-01")
  )

def convert(p: TimeseriesCount): Map[String, Int] = {
  Map("counter" -> p.count)
}

val feeder: Seq[Map[String, Int]] = DruidTimeSeriesQueryFeeder[TimeseriesCount, Int](
  timeSeriesQuery, convert _
)

import io.gatling.core.Predef._
import com.godatadriven.gatling.feeder.druid.Predef._

feed(druidFeeder[Int](feeder).circular)

case class extending the FeedElementBuilder

import com.godatadriven.gatling.feeder.druid.FeedElementBuilder
import com.godatadriven.gatling.feeder.druid.DruidTimeSeriesQueryFeeder
import ing.wbaa.druid.definitions.{Aggregation, Dimension}
import ing.wbaa.druid.query.TimeSeriesQuery

case class TimeseriesCountWithFeedElementBuilder(count: Int) 
  extends FeedElementBuilder[Int] {
    override def toFeedElement = Map("counter" -> count)
}

val timeSeriesQuery = TimeSeriesQuery[TimeseriesCountWithFeedElementBuilder](
    aggregations = List(
      Aggregation(
        kind = "count",
        name = "count",
        fieldName = "count"
      )
    ),
    granularity = "hour",
    intervals = List("2011-06-01/2017-06-01")
  )

val feeder: Seq[Map[String, Int]] = 
DruidTimeSeriesQueryFeeder[TimeseriesCountWithFeedElementBuilder, Int](
  timeSeriesQuery
)

import io.gatling.core.Predef._
import com.godatadriven.gatling.feeder.druid.Predef._

feed(druidFeeder[Int](feeder).circular)

How to build

Testing

Test need a druid docker container running. The command for that is:

docker run --rm -i -p 8082:8082 -p 8081:8081 fokkodriesprong/docker-druid

This is the same docker image used for testing the scruid library

Testing can be run with:

sbt test

Publishing

Requirements

Sonatype login

For publishing a sonatype login is required. Credential details can be put in a file called ~/.sbt/0.13/sonatype.sbt in the format

credentials += Credentials("Sonatype Nexus Repository Manager",
        "oss.sonatype.org",
        "<username>",
        "<password>")
GPG key

The sbt-gpg plugin uses the gpg commandline tool. On a Mac this can be installed and configured with the following commands:

brew install gnupg gnupg2
gpg --gen-key
gpg --list-keys
gpg --keyserver hkp://pgp.mit.edu --send-keys <KEY-UUID>

Publishing a SNAPSHOT version

export GPG_TTY=$(tty)
sbt publishSigned

Publishing a RELEASE version

After changing the version in build.sbt to a non snapshot version number

export GPG_TTY=$(tty)
sbt publishSigned
sbt sonatypeRelease

gatling-druid-feeder's People

Contributors

krisgeus avatar

Watchers

 avatar  avatar

Forkers

bjgbeelen

gatling-druid-feeder's Issues

Refactor transform function to less expose Gatling api.

Transform function currently results in a Vector[Record[T]]. Since record is just a type around Map[String, T] the output could be changed to a collection of Maps.
If the input type D has a toMap method we could even have a default transform function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.