druid-feeder

Gatling Feeder for using Druid queries as Custom Feed

License

License

Categories

Categories

Gatling Application Testing & Monitoring Data druid Databases
GroupId

GroupId

com.godatadriven.gatling
ArtifactId

ArtifactId

druid-feeder_2.12
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

druid-feeder
Gatling Feeder for using Druid queries as Custom Feed
Project URL

Project URL

https://github.com/krisgeus/gatling-druid-feeder/#readme
Project Organization

Project Organization

GoDataDriven
Source Code Management

Source Code Management

https://github.com/krisgeus/gatling-druid-feeder

Download druid-feeder_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.godatadriven.gatling/druid-feeder_2.12/ -->
<dependency>
    <groupId>com.godatadriven.gatling</groupId>
    <artifactId>druid-feeder_2.12</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.godatadriven.gatling/druid-feeder_2.12/
implementation 'com.godatadriven.gatling:druid-feeder_2.12:0.2.0'
// https://jarcasting.com/artifacts/com.godatadriven.gatling/druid-feeder_2.12/
implementation ("com.godatadriven.gatling:druid-feeder_2.12:0.2.0")
'com.godatadriven.gatling:druid-feeder_2.12:jar:0.2.0'
<dependency org="com.godatadriven.gatling" name="druid-feeder_2.12" rev="0.2.0">
  <artifact name="druid-feeder_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.godatadriven.gatling', module='druid-feeder_2.12', version='0.2.0')
)
libraryDependencies += "com.godatadriven.gatling" % "druid-feeder_2.12" % "0.2.0"
[com.godatadriven.gatling/druid-feeder_2.12 "0.2.0"]

Dependencies

compile (7)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.3
com.typesafe : config jar 1.3.1
ing.wbaa.druid » scruid_2.12 jar 0.0.8.3
ch.qos.logback : logback-classic jar 1.1.3
com.typesafe.akka : akka-http_2.12 jar 10.0.9
com.typesafe.akka : akka-stream_2.12 jar 2.5.2
io.gatling : gatling-core jar 3.0.0-SNAPSHOT

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.1

Project Modules

There are no modules declared in this project.

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

Versions

Version
0.2.0
0.1.0