Giter Club home page Giter Club logo

guardian-management-play's Introduction

Getting Started

Add the dependency to your build

resolvers += "Guardian Github Snapshots" at "http://guardian.github.com/maven/repo-releases"
libraryDependencies += "com.gu" %% "management-play" % "6.1"

Look at the example!

See example commit https://github.com/guardian/guardian-management/commit/f801e8d0

The example project has management routes set up and uses some switches and timing metrics.

$ git clone [email protected]:guardian/guardian-management-play.git
$ cd guardian-management-play
$ sbt
> project example
> run

Try the following URLs locally:

Also, enable the take-it-down switch and retry /scala-app.

Using the internal server in Play 2

Configure your dependencies

resolvers += "Guardian Github Snapshots" at "http://guardian.github.com/maven/repo-releases"
libraryDependencies += "com.gu" %% "management-play" % "6.1"

Add to the play plugins file

Add the following line to conf/play.plugins (create it if it doesn't exist):

1000:com.gu.management.play.InternalManagementPlugin

Bind the management pages

The plugin locates the pages and application name by convention.

Create a scala Object called conf.Management that mixes in the com.gu.management.play.Management trait to provide the list of pages and your application name to the plugin:

package conf

import com.gu.management._
import com.gu.management.logback.LogbackLevelPage
import com.gu.management.play.RequestMetrics

object Management extends com.gu.management.play.Management {
  val applicationName = "your-application-name"

  object Switches {
    val all = List(Healthcheck.switch)
  }

  object PlayExampleRequestMetrics extends RequestMetrics.Standard

  object Metrics {
    val all = PlayExampleRequestMetrics.asMetrics
  }

  lazy val pages = List(
    new ManifestPage,
    new HealthcheckManagementPage,
    new Switchboard(applicationName, Switches.all),
    StatusPage(applicationName, Metrics.all),
    new LogbackLevelPage(applicationName)
  )
}

If there is a reason you can't name your file conf.Management, you can override it by setting management.manifestobject in application.conf.

guardian-management-play's People

Contributors

rtyley avatar daithiocrualaoich avatar sihil avatar tackley avatar bruntonspall avatar bmjames avatar steppenwells avatar gklopper avatar robb1e avatar theefer avatar philwills avatar danmassie avatar kenlim avatar rupertbates avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.