finaglehelper on develop
finatra: Add validation to proj… (compare)
finaglehelper on gh-pages
site push by csl (compare)
finaglehelper on finatra-19.12.0
finaglehelper on develop
Twitter-oss: Prepare OSS librar… (compare)
finaglehelper on develop
Revert "Upgrade guava to 23.6.1… (compare)
finaglehelper on develop
finatra-http: Fix message body … (compare)
finaglehelper on develop
finatra: Update Link to Finagle… finatra: Remove Documentation O… (compare)
finaglehelper on develop
Upgrade guava to 23.6.1-jre **… (compare)
finaglehelper on develop
jackson: Update to 2.9.10 (and … (compare)
finaglehelper on develop
finatra/jackson: Remove Pants B… (compare)
finaglehelper on develop
finatra filters: Correctly coun… (compare)
finaglehelper on develop
finatra/doc: Fix typo in gettin… (compare)
class Main extends HttpServer {
init {
PrometheusMetricsCollector().register()
}
override val modules: Seq[TwitterModule] = Seq(DbConnectionProviderModule)
override def configureHttp(router: HttpRouter): Unit = {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[CommonFilters]
.filter[CorsFilter]
.exceptionMapper[EntityNotFoundExceptionMapper]
.exceptionMapper[MappingExistsMapper]
.exceptionMapper[OverCapacityExceptionMapper]
.exceptionMapper[DuplicateOccurrenceExceptionMapper]
.add[OccurrenceController]
.add[ZoneController]
}
premain {
addAdminRoute(PrometheusExporter.metricsRoute)
}
override protected def warmup(): Unit = {
handle[Warmup]
}
override protected def setup(): Unit = {
// Run migrations
val conf: Config = ConfigFactory.load()
val dbConfig: Config = conf.getConfig("gregor.db")
Utils
.buildMigrateConf(dbConfig)
.locations("com.armoredthings.gregor.database.migration")
.load()
.migrate()
super.setup()
}
}
@cacoco looked into this a little bit more.
1) The error is directly coming from Prometheus.register() that is inside the trait.
2) The lifecycle approach doesn't work either, however is there a way to override the lifecycle hooks? If I was able to do that, I can init prometheus on premain in the application but override it in the EmbeddedHttpServer. Wasn't able to locate a way of doing this tho
3) On that note
import com.twitter.finagle.metrics._
seems to be deprecated. I was able to locate MetricsStatsReceiver in
com.twitter.finagle.stats.MetricsStatsReceiver
but it doesn't seem to expose those .metrics. Is there a corresponding version of this in the most recent finagle ?
premain {
s.get match {
case None =>
PrometheusMetricsCollector().register()
addAdminRoute(Route.isolate(Route(
path = "/metrics",
handler = new PrometheusMetricsExporterService(),
alias = "Prometheus Metrics",
group = Some(Grouping.Metrics),
includeInIndex = true
)
))
case Some("prod") =>
PrometheusMetricsCollector().register()
addAdminRoute(Route.isolate(Route(
path = "/metrics",
handler = new PrometheusMetricsExporterService(),
alias = "Prometheus Metrics",
group = Some(Grouping.Metrics),
includeInIndex = true
)
))
case Some(r) => r
}
}
Referencing bug: twitter/finatra#514
Migrated from finatra-19.7.0 to 19.11.0, now the Controller will not resolve endpoints with parameters, like /api/hello/:status/
Was using 19.7.0 for several months, the routing was working as expected; I am also utilizing the prefixes. I just upgraded to 19.11.0 on @jyanJing 's recommendation to get the streaming updates:
Hi @mehulmistryavlino , unfortunately there is no resource management for AsyncStream, afaik, there is no interface to disconnect an ongoing AsyncStream. This is why we have rolled out a new version of streaming, which is backed by Reader instead of AsyncStream. We recommend you to switch to the newer version to solve this particular problem. It is very user friendly, you can still keep the AsyncStream but use the
Reader.fromAsyncStream
interface to create a Reader, then pass the Reader to create aStreamingResponse
, and you can usereader.discard()
to close streaming connection through the Reader. Here is the user guide: https://docbird.twitter.biz/finatra/user-guide/http/streaming.html. Please let me know if you have any questions!
Now all of the endpoints containing params are not being found.
NoClassDefFoundError on c/t/util/Promise$
stack trace if I double Ctrl-c in sbt run
and this won't happen if I shutdown from admin console on 9990 port. Is this normal behavior? My main object extends HttpServer
. Do I have to write something on onExit{}
in my class or something?
examples/http-server
? The repo's build.sbt seems too big for my simple project...
name := "inu"
version := "0.1"
scalaVersion := "2.12.8"
libraryDependencies ++= Seq(
"com.twitter" %% "finatra-http" % "19.10.0",
"com.twitter" %% "finatra-http" % "19.10.0" % Test classifier "tests",
"com.twitter" %% "inject-server" % "19.10.0" % Test classifier "tests",
"com.twitter" %% "inject-app" % "19.10.0" % Test classifier "tests",
"com.twitter" %% "inject-core" % "19.10.0" % Test classifier "tests",
"com.twitter" %% "inject-modules" % "19.10.0" % Test classifier "tests",
"org.scalatest" %% "scalatest" % "3.0.0" % Test,
"com.google.inject" % "guice" % "4.2.2",
"com.google.inject.extensions" % "guice-testlib" % "4.2.2" % Test classifier "tests",
"ch.qos.logback" % "logback-classic" % "1.1.7",
)
Promise
, Hotspot
and so on when I use C-c C-c
in sbt especially after been kept the app up for quite a while (like 3 hours). However, these never come out with admin console shutdown. I decided move forward about my project rather than identifying the cause. I will raise issues once it comes even with admin console shutdown. Thank you for your help.