Permalink
Browse files

wip

  • Loading branch information...
1 parent ee7e221 commit a74379942b2c672c9ba507093f27ead5693c1240 @dpsoft dpsoft committed Dec 13, 2016
Showing with 14,008 additions and 23 deletions.
  1. +8 −3 build.sbt
  2. +13 −13 kamon-core/src/main/scala/kamon/util/executors/ExecutorMetricRecorder.scala
  3. +64 −0 kamon-examples/kamon-annotation-example/java/pom.xml
  4. +12 −0 kamon-examples/kamon-annotation-example/java/src/main/java/kamon/KamonSpringApplication.java
  5. +22 −0 kamon-examples/kamon-annotation-example/java/src/main/java/kamon/akka/pingpong/PingPong.java
  6. +12 −0 kamon-examples/kamon-annotation-example/java/src/main/java/kamon/akka/pingpong/Pinger.java
  7. +12 −0 kamon-examples/kamon-annotation-example/java/src/main/java/kamon/akka/pingpong/Ponger.java
  8. +17 −0 kamon-examples/kamon-annotation-example/java/src/main/java/kamon/annotation/KamonController.java
  9. +8 −0 kamon-examples/kamon-annotation-example/java/src/main/resources/META-INF/aop.xml
  10. +21 −0 kamon-examples/kamon-annotation-example/java/src/main/resources/application.conf
  11. +19 −0 kamon-examples/kamon-annotation-example/java/src/main/resources/logback.xml
  12. +22 −0 kamon-examples/kamon-annotation-example/scala/build.sbt
  13. +1 −0 kamon-examples/kamon-annotation-example/scala/project/plugins.sbt
  14. +8 −0 kamon-examples/kamon-annotation-example/scala/src/main/resources/META-INF/aop.xml
  15. +10 −0 kamon-examples/kamon-annotation-example/scala/src/main/resources/application.conf
  16. +19 −0 kamon-examples/kamon-annotation-example/scala/src/main/resources/logback.xml
  17. +17 −0 kamon-examples/kamon-annotation-example/scala/src/main/scala/kamon/annotation/KamonController.scala
  18. +10 −0 ...mples/kamon-annotation-example/scala/src/main/scala/kamon/annotation/KamonSpringApplication.scala
  19. +62 −0 kamon-examples/kamon-autoweave-example/build.sbt
  20. +1 −0 kamon-examples/kamon-autoweave-example/project/build.properties
  21. +6 −0 kamon-examples/kamon-autoweave-example/project/plugins.sbt
  22. +18 −0 kamon-examples/kamon-autoweave-example/src/main/resources/application.conf
  23. +11 −0 kamon-examples/kamon-autoweave-example/src/main/resources/logback.xml
  24. +40 −0 kamon-examples/kamon-autoweave-example/src/main/scala/kamon/autoweave/example/PingPong.scala
  25. +31 −0 kamon-examples/kamon-fluentd-example/README.md
  26. +31 −0 kamon-examples/kamon-fluentd-example/build.sbt
  27. +1 −0 kamon-examples/kamon-fluentd-example/project/build.properties
  28. +6 −0 kamon-examples/kamon-fluentd-example/project/plugins.sbt
  29. +73 −0 kamon-examples/kamon-fluentd-example/src/main/resources/application.conf
  30. +60 −0 kamon-examples/kamon-fluentd-example/src/main/scala/KamonFluentdExample.scala
  31. +26 −0 kamon-examples/kamon-newrelic-example/build.sbt
  32. +1 −0 kamon-examples/kamon-newrelic-example/project/build.properties
  33. +9 −0 kamon-examples/kamon-newrelic-example/project/plugins.sbt
  34. +10 −0 kamon-examples/kamon-newrelic-example/src/main/resources/application.conf
  35. +40 −0 kamon-examples/kamon-newrelic-example/src/main/scala/NewRelicExample.scala
  36. +7 −0 kamon-examples/kamon-play-example-2.4.x/app/Filters.scala
  37. +83 −0 kamon-examples/kamon-play-example-2.4.x/app/controllers/KamonPlayExample.scala
  38. +60 −0 kamon-examples/kamon-play-example-2.4.x/app/filters/TraceLocalFilter.scala
  39. +65 −0 kamon-examples/kamon-play-example-2.4.x/conf/application.conf
  40. +27 −0 kamon-examples/kamon-play-example-2.4.x/conf/logger.xml
  41. +5 −0 kamon-examples/kamon-play-example-2.4.x/conf/routes
  42. +52 −0 kamon-examples/kamon-play-example-2.4.x/project/Build.scala
  43. +1 −0 kamon-examples/kamon-play-example-2.4.x/project/build.properties
  44. +10 −0 kamon-examples/kamon-play-example-2.4.x/project/plugins.sbt
  45. BIN kamon-examples/kamon-play-example-2.4.x/public/images/favicon.png
  46. BIN kamon-examples/kamon-play-example-2.4.x/public/images/glyphicons-halflings-white.png
  47. BIN kamon-examples/kamon-play-example-2.4.x/public/images/glyphicons-halflings.png
  48. +4 −0 kamon-examples/kamon-play-example-2.4.x/public/javascripts/jquery-1.9.0.min.js
  49. +6,158 −0 kamon-examples/kamon-play-example-2.4.x/public/stylesheets/bootstrap.css
  50. 0 kamon-examples/kamon-play-example-2.4.x/public/stylesheets/main.css
  51. +30 −0 kamon-examples/kamon-play-example/app/Global.scala
  52. +83 −0 kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
  53. +60 −0 kamon-examples/kamon-play-example/app/filters/TraceLocalFilter.scala
  54. +67 −0 kamon-examples/kamon-play-example/conf/application.conf
  55. +27 −0 kamon-examples/kamon-play-example/conf/logger.xml
  56. +5 −0 kamon-examples/kamon-play-example/conf/routes
  57. +52 −0 kamon-examples/kamon-play-example/project/Build.scala
  58. +1 −0 kamon-examples/kamon-play-example/project/build.properties
  59. +10 −0 kamon-examples/kamon-play-example/project/plugins.sbt
  60. BIN kamon-examples/kamon-play-example/public/images/favicon.png
  61. BIN kamon-examples/kamon-play-example/public/images/glyphicons-halflings-white.png
  62. BIN kamon-examples/kamon-play-example/public/images/glyphicons-halflings.png
  63. +4 −0 kamon-examples/kamon-play-example/public/javascripts/jquery-1.9.0.min.js
  64. +6,158 −0 kamon-examples/kamon-play-example/public/stylesheets/bootstrap.css
  65. 0 kamon-examples/kamon-play-example/public/stylesheets/main.css
  66. +28 −0 kamon-examples/kamon-scalatra-example/project/AspectJ.scala
  67. +65 −0 kamon-examples/kamon-scalatra-example/project/Build.scala
  68. +1 −0 kamon-examples/kamon-scalatra-example/project/build.properties
  69. +1 −0 kamon-examples/kamon-scalatra-example/project/plugins.sbt
  70. +19 −0 kamon-examples/kamon-scalatra-example/src/main/resources/application.conf
  71. +11 −0 kamon-examples/kamon-scalatra-example/src/main/resources/logback.xml
  72. +32 −0 kamon-examples/kamon-scalatra-example/src/main/scala/ScalatraBootstrap.scala
  73. +39 −0 kamon-examples/kamon-scalatra-example/src/main/scala/kamon/example/EmbeddedServer.scala
  74. +65 −0 kamon-examples/kamon-scalatra-example/src/main/scala/kamon/example/KamonServlet.scala
  75. +34 −0 kamon-examples/kamon-scalatra-example/src/main/scala/kamon/example/KamonSupport.scala
  76. +9 −0 kamon-examples/kamon-scalatra-example/src/webapp/WEB-INF/web.xml
  77. +8 −0 project/Dependencies.scala
  78. +6 −7 project/Settings.scala
View
@@ -26,18 +26,21 @@ lazy val kamon = (project in file("."))
lazy val core = (project in file("kamon-core"))
+ .settings(moduleName := "kamon-core")
.settings(basicSettings: _*)
.settings(formatSettings: _*)
.settings(
libraryDependencies ++=
- compileScope(akkaActor, hdrHistogram, slf4jApi) ++
+ compileScope(akkaDependency("actor").value, hdrHistogram, slf4jApi) ++
providedScope(aspectJ) ++
optionalScope(logback) ++
- testScope(scalatest, akkaTestKit, akkaSlf4j, logback))
+ testScope(scalatest, akkaDependency("testkit").value, akkaDependency("slf4j").value, logback))
+
lazy val autoweave = (project in file("kamon-autoweave"))
.dependsOn(core)
+ .settings(moduleName := "kamon-autoweave")
.settings(basicSettings: _*)
.settings(formatSettings: _*)
.settings(
@@ -48,16 +51,18 @@ lazy val autoweave = (project in file("kamon-autoweave"))
lazy val testkit = (project in file("kamon-testkit"))
.dependsOn(core)
+ .settings(moduleName := "kamon-testkit")
.settings(basicSettings: _*)
.settings(formatSettings: _*)
.settings(
libraryDependencies ++=
- compileScope(akkaActor, akkaTestKit) ++
+ compileScope(akkaActor, akkaDependency("testkit").value) ++
providedScope(aspectJ) ++
testScope(slf4jApi, slf4jnop))
lazy val bench = (project in file("kamon-bench"))
.dependsOn(core)
+ .settings(moduleName := "kamon-bench")
.settings(basicSettings: _*)
.settings(formatSettings: _*)
.settings(noPublishing: _*)
@@ -1,6 +1,6 @@
/*
* =========================================================================================
- * Copyright © 2013-2015 the kamon project <http://kamon.io/>
+ * Copyright © 2013-2016 the kamon project <http://kamon.io/>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
@@ -23,7 +23,7 @@ import kamon.util.executors.ForkJoinPools.ForkJoinMetrics
import scala.concurrent.forkjoin.ForkJoinPool
-object ForkJoinPools {
+object ForkJoinPools extends ForkJoinLowPriority {
trait ForkJoinMetrics[T] {
def getParallelism(fjp: T): Long
def getPoolSize(fjp: T): Long
@@ -33,24 +33,24 @@ object ForkJoinPools {
def getQueuedSubmissionCount(fjp: T): Long
}
- implicit object ScalaForkJoin extends ForkJoinMetrics[ForkJoinPool] {
- def getParallelism(fjp: ForkJoinPool) = fjp.getParallelism
- def getPoolSize(fjp: ForkJoinPool) = fjp.getPoolSize.toLong
- def getRunningThreadCount(fjp: ForkJoinPool) = fjp.getActiveThreadCount.toLong
- def getActiveThreadCount(fjp: ForkJoinPool) = fjp.getRunningThreadCount.toLong
- def getQueuedTaskCount(fjp: ForkJoinPool) = fjp.getQueuedTaskCount
- def getQueuedSubmissionCount(fjp: ForkJoinPool) = fjp.getQueuedSubmissionCount
-
- }
-
implicit object JavaForkJoin extends ForkJoinMetrics[JavaForkJoinPool] {
def getParallelism(fjp: JavaForkJoinPool) = fjp.getParallelism
def getPoolSize(fjp: JavaForkJoinPool) = fjp.getPoolSize.toLong
def getRunningThreadCount(fjp: JavaForkJoinPool) = fjp.getActiveThreadCount.toLong
def getActiveThreadCount(fjp: JavaForkJoinPool) = fjp.getRunningThreadCount.toLong
def getQueuedTaskCount(fjp: JavaForkJoinPool) = fjp.getQueuedTaskCount
def getQueuedSubmissionCount(fjp: JavaForkJoinPool) = fjp.getQueuedSubmissionCount
+ }
+}
+trait ForkJoinLowPriority {
+ implicit object ScalaForkJoin extends ForkJoinMetrics[ForkJoinPool] {
+ def getParallelism(fjp: ForkJoinPool) = fjp.getParallelism
+ def getPoolSize(fjp: ForkJoinPool) = fjp.getPoolSize.toLong
+ def getRunningThreadCount(fjp: ForkJoinPool) = fjp.getActiveThreadCount.toLong
+ def getActiveThreadCount(fjp: ForkJoinPool) = fjp.getRunningThreadCount.toLong
+ def getQueuedTaskCount(fjp: ForkJoinPool) = fjp.getQueuedTaskCount
+ def getQueuedSubmissionCount(fjp: ForkJoinPool) = fjp.getQueuedSubmissionCount
}
}
@@ -96,4 +96,4 @@ object ThreadPoolExecutorMetrics {
def category: String = cat
def createRecorder(instrumentFactory: InstrumentFactory) = new ThreadPoolExecutorMetrics(tpe, instrumentFactory)
}
-}
+}
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>kamon.annotation</groupId>
+ <artifactId>kamon-spring-boot</artifactId>
+ <version>0.1.0</version>
+
+
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>1.4.0.RELEASE</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.kamon</groupId>
+ <artifactId>kamon-core_2.11</artifactId>
+ <version>0.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>io.kamon</groupId>
+ <artifactId>kamon-annotation_2.11</artifactId>
+ <version>0.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>io.kamon</groupId>
+ <artifactId>kamon-akka_2.11</artifactId>
+ <version>0.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>io.kamon</groupId>
+ <artifactId>kamon-log-reporter_2.11</artifactId>
+ <version>0.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <java.version>1.8</java.version>
+ </properties>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>io.kamon</id>
+ <url>http://snapshots.kamon.io</url>
+ </repository>
+ </repositories>
+</project>
@@ -0,0 +1,12 @@
+package kamon;
+
+import kamon.akka.pingpong.PingPong;
+import kamon.annotation.KamonController;
+import org.springframework.boot.SpringApplication;
+
+public class KamonSpringApplication {
+ public static void main(String... args) {
+ Kamon.start();
+ SpringApplication.run(new Object[] {KamonController.class, PingPong.class}, args);
+ }
+}
@@ -0,0 +1,22 @@
+package kamon.akka.pingpong;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Component
+public class PingPong {
+
+ @PostConstruct
+ public void initialize() {
+ final ActorSystem system = ActorSystem.create("kamon-spring-boot-actor-system");
+
+ final ActorRef pinger = system.actorOf(Props.create(Pinger.class), "pinger");
+ final ActorRef ponger = system.actorOf(Props.create(Ponger.class), "ponger");
+
+ pinger.tell(new Ponger.PongMessage(), ponger);
+ }
+}
@@ -0,0 +1,12 @@
+package kamon.akka.pingpong;
+
+import akka.actor.UntypedActor;
+
+class Pinger extends UntypedActor {
+ static final class PingMessage {}
+
+ public void onReceive(Object message) throws Exception {
+ if (message instanceof Ponger.PongMessage) getSender().tell(new PingMessage(), getSelf());
+ else unhandled(message);
+ }
+}
@@ -0,0 +1,12 @@
+package kamon.akka.pingpong;
+
+import akka.actor.UntypedActor;
+
+class Ponger extends UntypedActor {
+ static final class PongMessage {}
+
+ public void onReceive(Object message) throws Exception {
+ if (message instanceof Pinger.PingMessage) getSender().tell(new PongMessage(), getSelf());
+ else unhandled(message);
+ }
+}
@@ -0,0 +1,17 @@
+package kamon.annotation;
+
+import org.springframework.boot.autoconfigure.*;
+import org.springframework.stereotype.*;
+import org.springframework.web.bind.annotation.*;
+
+@Controller
+@EnableAutoConfiguration
+@RequestMapping("/kamon")
+@EnableKamon
+public class KamonController {
+
+ @RequestMapping("/counter")
+ @ResponseBody
+ @Count(name = "awesomeCounter")
+ public String counter() { return "count!!!"; }
+}
@@ -0,0 +1,8 @@
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+
+<aspectj>
+ <weaver options="-Xlint:ignore">
+ <include within="kamon..*"/>
+ <exclude within="org.aspectj.*"/>
+ </weaver>
+</aspectj>
@@ -0,0 +1,21 @@
+###############################
+# Kamon related configuration #
+###############################
+
+kamon {
+
+ metric {
+ filters {
+ trace.includes = [ "**" ]
+ akka-actor.includes = [ "**" ]
+ akka-actor.excludes = ["*/system/**", "*/user/IO-**" ]
+ akka-dispatcher.includes = [ "**" ]
+ akka-dispatcher.excludes = [ ]
+ }
+ }
+
+ modules {
+ kamon-annotation.auto-start = yes
+ kamon-log-reporter.auto-start = yes
+ }
+}
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <property name="CONSOLE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"/>
+
+ <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${CONSOLE_LOG_PATTERN}</pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="CONSOLE" />
+ </root>
+
+ <!-- logger name="org.springframework" level="DEBUG"/ -->
+
+</configuration>
@@ -0,0 +1,22 @@
+name := "spring-boot-kamon"
+
+version := "1.0"
+
+scalaVersion := "2.11.6"
+
+sbtVersion := "0.13.1"
+
+resolvers += "Kamon Repository Snapshots" at "http://snapshots.kamon.io"
+
+libraryDependencies ++= Seq(
+ "org.springframework.boot" % "spring-boot-starter-web" % "1.2.3.RELEASE",
+ "io.kamon" %% "kamon-core" % "0.5.2",
+ "io.kamon" %% "kamon-annotation" % "0.5.2",
+ "io.kamon" %% "kamon-log-reporter" % "0.5.2"
+)
+
+aspectjSettings
+
+fork in run := true
+
+javaOptions in run <++= AspectjKeys.weaverOptions in Aspectj
@@ -0,0 +1 @@
+addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.10.0")
@@ -0,0 +1,8 @@
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+
+<aspectj>
+ <weaver options="-Xlint:ignore">
+ <include within="kamon..*"/>
+ <exclude within="org.aspectj.*"/>
+ </weaver>
+</aspectj>
@@ -0,0 +1,10 @@
+###############################
+# Kamon related configuration #
+###############################
+
+kamon {
+ modules {
+ kamon-annotation.auto-start = yes
+ kamon-log-reporter.auto-start = yes
+ }
+}
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <property name="CONSOLE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"/>
+
+ <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${CONSOLE_LOG_PATTERN}</pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="CONSOLE" />
+ </root>
+
+ <!-- logger name="org.springframework" level="DEBUG"/ -->
+
+</configuration>
@@ -0,0 +1,17 @@
+package kamon.annotation
+
+import org.springframework.boot.autoconfigure._
+import org.springframework.stereotype._
+import org.springframework.web.bind.annotation._
+
+@Controller
+@EnableAutoConfiguration
+@RequestMapping(Array("/kamon"))
+@EnableKamon
+class KamonController {
+
+ @RequestMapping(Array("/counter"))
+ @ResponseBody
+ @Count(name = "awesomeCounter")
+ def counter(): String = "count!!!"
+}
@@ -0,0 +1,10 @@
+package kamon.annotation
+
+import kamon.Kamon
+import org.springframework.boot.SpringApplication
+
+object KamonSpringApplication extends App {
+ Kamon.start()
+
+ SpringApplication.run(classOf[KamonController])
+}
Oops, something went wrong.

0 comments on commit a743799

Please sign in to comment.