-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
282 changed files
with
9,038 additions
and
3,389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
language: scala | ||
|
||
jdk: | ||
- oraclejdk8 | ||
|
||
scala: | ||
- 2.11.6 | ||
env: | ||
- SBT_OPTS="-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:PermSize=256m -XX:MaxPermSize=512m -Xms128m -Xmx512m" | ||
- JAVA_OPTS="-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m" | ||
|
||
addons: | ||
postgresql: "9.3" | ||
|
||
before_script: | ||
- psql -c "CREATE DATABASE octoparts_test WITH ENCODING 'UTF8';" -U postgres | ||
- psql -c "CREATE USER octoparts_app WITH PASSWORD '';" -U postgres | ||
- psql -c "GRANT ALL PRIVILEGES ON DATABASE octoparts_test to octoparts_app;" -U postgres | ||
|
||
script: | ||
- sbt clean compile | ||
- sbt coverage test | ||
- find $HOME/.sbt -name "*.lock" -type f -delete && find $HOME/.ivy2/cache -name "*[\[\]\(\)]*.properties" -type f -delete | ||
|
||
after_success: sbt coverageAggregate coveralls | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.sbt | ||
- $HOME/.ivy2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2014 M3, Inc. | ||
|
||
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 | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Octoparts | ||
# Octoparts [![Build Status](https://travis-ci.org/m3dev/octoparts.svg?branch=develop)](https://travis-ci.org/m3dev/octoparts) [![Coverage Status](https://coveralls.io/repos/m3dev/octoparts/badge.svg?branch=develop)](https://coveralls.io/r/m3dev/octoparts?branch=develop) | ||
|
||
[See documentation](http://m3dev.github.io/octoparts/) | ||
|
||
Also see these [Lightning talk slides](https://docs.google.com/presentation/d/1dgbLSaEyWydGX6SaPtGeKXX-6p-0OuUvnWFpiOqgoQo/edit?usp=sharing) from ScalaMatsuri 2014 for a quick explanation of what Octoparts is all about. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.m3.octoparts | ||
|
||
import com.codahale.metrics.SharedMetricRegistries | ||
import play.api.Play | ||
|
||
object OctopartsMetricsRegistry { | ||
/** | ||
* Same as [[com.kenshoo.play.metrics.MetricsRegistry.defaultRegistry]] when a Play app is running; uses the default name ("default") otherwise | ||
*/ | ||
val default = SharedMetricRegistries.getOrCreate(Play.maybeApplication.flatMap(_.configuration.getString("metrics.name")).getOrElse("default")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.m3.octoparts | ||
|
||
import java.net.InetAddress | ||
|
||
import com.beachape.zipkin.services.{ BraveZipkinService, NoopZipkinService, ZipkinServiceLike } | ||
import com.github.kristofa.brave.zipkin.ZipkinSpanCollector | ||
import play.api.{ Logger, Play } | ||
|
||
import scala.util.{ Failure, Success, Try } | ||
|
||
object ZipkinServiceHolder { | ||
|
||
private implicit val app = play.api.Play.current | ||
private implicit val ex = play.api.libs.concurrent.Execution.Implicits.defaultContext | ||
|
||
val ZipkinService: ZipkinServiceLike = if (Play.isTest) { | ||
NoopZipkinService | ||
} else { | ||
val maybeService = for { | ||
zipkinHost <- Play.configuration.getString("zipkin.host") | ||
zipkinPort <- Play.configuration.getInt("zipkin.port") | ||
zipkinRate <- Play.configuration.getDouble("zipkin.sampleRate") | ||
env <- Play.configuration.getString("application.env") | ||
} yield { | ||
Try { | ||
val zipkinSpanCollector = new ZipkinSpanCollector(zipkinHost, zipkinPort) | ||
sys.addShutdownHook(zipkinSpanCollector.close()) | ||
val currentHostName = InetAddress.getLocalHost.getHostName | ||
val currentRunningPort = Play.configuration.getInt("http.port").getOrElse(9000) | ||
new BraveZipkinService( | ||
hostIp = currentHostName, | ||
hostPort = currentRunningPort, | ||
serviceName = s"Octoparts - $env", | ||
collector = zipkinSpanCollector, | ||
clientTraceFilters = Seq(_.isSetParent_id), | ||
serverTraceFilters = Seq( | ||
{ s => | ||
val name = s.getName | ||
!(name.startsWith("OPTION") || name.startsWith("GET - /assets")) | ||
}, | ||
{ s => s.isSetParent_id || (zipkinRate > scala.util.Random.nextDouble()) } | ||
) | ||
) | ||
} | ||
|
||
} | ||
maybeService match { | ||
case Some(Success(zipkinService)) => zipkinService | ||
case Some(Failure(e)) => { | ||
Logger.error("Could not create the Zipkin service", e) | ||
NoopZipkinService | ||
} | ||
case None => { | ||
Logger.warn("Zipkin configs are missing in the current environment, falling back to NoopZipkinService") | ||
NoopZipkinService | ||
} | ||
} | ||
} | ||
|
||
} |
12 changes: 0 additions & 12 deletions
12
app/com/m3/octoparts/aggregator/handler/AggregatorHandlersModule.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/com/m3/octoparts/aggregator/handler/HttpHandlerFactory.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.