Skip to content

Commit a0a73be

Browse files
authored
Merge pull request #3 from StreetContxt/tweak-stats
Tweaked stats
2 parents 7a30a5d + 1508865 commit a0a73be

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
organization in ThisBuild := "com.contxt"
22
scalaVersion in ThisBuild := "2.11.8"
3-
version in ThisBuild := "1.0.0-SNAPSHOT"
3+
version in ThisBuild := "1.0.1-SNAPSHOT"
44

55
val slf4j = "org.slf4j" % "slf4j-api" % "1.7.21"
66
val amazonKinesisProducer = "com.amazonaws" % "amazon-kinesis-producer" % "0.12.8"

src/main/scala/com/contxt/kinesis/ProducerStats.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import scala.util.control.NonFatal
88

99
trait ProducerStats {
1010
def trackSend(streamId: StreamId, size: Int)(closure: => Future[UserRecordResult]): Future[UserRecordResult]
11+
def reportInitialization(streamId: StreamId): Unit
1112
def reportShutdown(streamId: StreamId): Unit
1213
}
1314

@@ -29,5 +30,6 @@ object ProducerStats {
2930

3031
class NoopProducerStats extends ProducerStats {
3132
def trackSend(streamId: StreamId, size: Int)(closure: => Future[UserRecordResult]): Future[UserRecordResult] = closure
33+
def reportInitialization(streamId: StreamId): Unit = {}
3234
def reportShutdown(streamId: StreamId): Unit = {}
3335
}

src/main/scala/com/contxt/kinesis/ScalaKinesisProducer.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ private[kinesis] class ScalaKinesisProducerImpl(
6161
) extends ScalaKinesisProducer {
6262
import ScalaKinesisProducer.listenableToScalaFuture
6363

64+
stats.reportInitialization(streamId)
65+
6466
def send(partitionKey: String, data: ByteBuffer, explicitHashKey: Option[String]): Future[UserRecordResult] = {
6567
stats.trackSend(streamId, data.remaining) {
6668
producer.addUserRecord(streamId.streamName, partitionKey, explicitHashKey.orNull, data).map { result =>

0 commit comments

Comments
 (0)