status-page


License

License

GroupId

GroupId

eu.timepit
ArtifactId

ArtifactId

status-page-core_2.13
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

status-page
status-page
Project URL

Project URL

https://github.com/fthomas/status-page
Project Organization

Project Organization

eu.timepit
Source Code Management

Source Code Management

https://github.com/fthomas/status-page

Download status-page-core_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/eu.timepit/status-page-core_2.13/ -->
<dependency>
    <groupId>eu.timepit</groupId>
    <artifactId>status-page-core_2.13</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/eu.timepit/status-page-core_2.13/
implementation 'eu.timepit:status-page-core_2.13:0.3.0'
// https://jarcasting.com/artifacts/eu.timepit/status-page-core_2.13/
implementation ("eu.timepit:status-page-core_2.13:0.3.0")
'eu.timepit:status-page-core_2.13:jar:0.3.0'
<dependency org="eu.timepit" name="status-page-core_2.13" rev="0.3.0">
  <artifact name="status-page-core_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='eu.timepit', module='status-page-core_2.13', version='0.3.0')
)
libraryDependencies += "eu.timepit" % "status-page-core_2.13" % "0.3.0"
[eu.timepit/status-page-core_2.13 "0.3.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.5

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.13 jar 3.2.6

Project Modules

There are no modules declared in this project.

status-page

GitHub Workflow Status codecov Scaladex Scaladoc

status-page is a microlibrary for creating simple status pages. It provides data structures and functions to organize, aggregate, and render status information in a straightforward way.

Quick example

import cats.effect.IO
import eu.timepit.statuspage.cats.Make
import eu.timepit.statuspage.core.Result.{Ok, Warning}
import eu.timepit.statuspage.core.plaintext

// We use `IO` values for status checks, but the library supports any
// type that is an `ApplicativeError`.
val uptime: IO[String] = IO("up 2 weeks, 3 days, 13 hours, 27 minutes")
val dbQuery: IO[Unit] = IO(())
val dbItems: IO[Int] = IO(38)
val sparkNode1: IO[Unit] = IO(())
val sparkNode2: IO[Unit] = IO.raiseError(new Exception("unreachable"))
val mk = new Make[IO, Throwable](_.getMessage)
// mk: eu.timepit.statuspage.cats.Make[cats.effect.IO,Throwable] = eu.timepit.statuspage.cats.Make@12af9bd3

val root = mk.root(
  mk.entryInfo("uptime", uptime),
  mk.group(
    "database",
    mk.entryOk("query", dbQuery),
    mk.entry("items", dbItems)(i => if (i > 50) Ok else Warning.withMsg(i.toString))
  ),
  mk.group(
    "spark_cluster",
    mk.entryOk("node1", sparkNode1),
    mk.entryOk("node2", sparkNode2)
  )
)
// root: cats.effect.IO[eu.timepit.statuspage.core.Root] = <function1>

root.map(plaintext.renderRoot).unsafeRunSync()
// res0: String =
// status: ERROR
// uptime: up 2 weeks, 3 days, 13 hours, 27 minutes
// database_status: WARNING
// database_query: OK
// database_items: WARNING 38
// spark_cluster_status: ERROR
// spark_cluster_node1: OK
// spark_cluster_node2: ERROR unreachable

Using status-page

The latest version of the library is available for Scala 2.12, 2.13, and 3.

If you're using sbt, add the following to your build:

libraryDependencies ++= Seq(
  "eu.timepit" %% "status-page-core" % "<latestVersion>",
  "eu.timepit" %% "status-page-cats" % "<latestVersion>"
)

License

status-page is licensed under the Apache License, Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 and also in the LICENSE file.

Versions

Version
0.3.0
0.2.8
0.2.7