EzDevInfo.com

ostrich

A stats collector & reporter for Scala servers

How is Ostrich used for configuration?

I need a way to configure my scala application. Configgy seemed the way to go in Scala but it is deprecated https://github.com/robey/configgy#readme and now this functionality is in Ostrich.

Is there a code example on how to use Ostrich only for configuration? I'm not interested in collecting the statistics.


Source: (StackOverflow)

Is there a Java equivalent of Twitter's Ostrich library?

The ostrich project from Twitter seems to be a good fit for my use case where I would like to track lot of JVM based statistics plus some custom statistics.

https://github.com/twitter/ostrich/

However, my code base is pure Java + Spring 3.0, rather than Scala, so can I use Ostrich for my case?


Source: (StackOverflow)

Advertisements

Ostrich can't compile configuration file

I'm trying to use ostrich as configuration library in my new application (previously I had a positive experience using it for runtime statistics). But I can't get it work using the code snippet from the readme.

Here is my code:

class Boot {
  val bootLogger = LoggerFactory.getLogger(this.getClass)//slf4j
  val confPath = Option(System.getenv("CONF_FILE"))
  //living inside akka-kernel, so there is no access to real args
  val args: Array[String] = confPath match {
    case Some(path) => Array("-f", path)
    case None       => Array()
  }

  bootLogger.info(Class.forName("la.myproject.Config").toString)

  val runtime = RuntimeEnvironment(this, args)
  val server = runtime.loadRuntimeConfig[Server]()
  try {
    server.start()
  } catch {
    case e: Exception =>
      bootLogger.error("Server start failed", e)
  }
}

And this is my config:

new la.myproject.Config {
  //use the defaults
}

The program successfully loads the configuration class and fails with the following eror:

Error in config file: ../../src/main/conf/myproject.scala

com.twitter.util.Eval$CompilerException: Compiler exception error: line 3: not found: value la

new la.myproject.Config {

I guess that it is a class loading problem. But digging through sources gave me no clue why it happens. Ostrich as well as Eval utility don't touch classloading at all.


Source: (StackOverflow)

How to use Ostrich

I have a task to collect and report some runtime statistics for my application. Ostrich looks quite friendly in both API and feature set. But I can't find any documentation about the most of declared features. Especially it is difficult to configure stats reporting through the web interface without any understanding of configuration principles.

So my main question: is there any documentation besides the README?

If no, could someone give an example of the following features (all of them are from the top of README):

  • load & reload per-environment configuration (there is example on SO already, but what if I want to use a classpath resource? how to define an environment? how to reload configuration?)
  • report statistics into log files

Or (perfectly) give a good architectural overview of configuration in Ostrich so I can find some way to do configuration by myself.


Source: (StackOverflow)