add api document
diff --git a/doc/source/conf.py b/doc/source/conf.py
index afa4c10..5736d04 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -46,6 +46,8 @@
'sphinx.ext.githubpages',
]
+html_style = 'css/s2graph_style.css'
+
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 83bf8d5..fd4e755 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -20,6 +20,7 @@
getting_started/index
getting_started/your_first_graph
+ api/index
..
Indices and tables
diff --git a/s2http/src/main/scala/org/apache/s2graph/http/Server.scala b/s2http/src/main/scala/org/apache/s2graph/http/Server.scala
index 03802ed..e70a182 100644
--- a/s2http/src/main/scala/org/apache/s2graph/http/Server.scala
+++ b/s2http/src/main/scala/org/apache/s2graph/http/Server.scala
@@ -19,6 +19,8 @@
package org.apache.s2graph.http
+import java.time.Instant
+
import scala.language.postfixOps
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.duration.Duration
@@ -51,9 +53,13 @@
val port = sys.props.get("http.port").fold(8000)(_.toInt)
val interface = sys.props.get("http.interface").fold("0.0.0.0")(identity)
- val serverStatus = s""" { "port": ${port}, "interface": ${interface}, "started_at": ${System.currentTimeMillis()} }"""
+ val startAt = System.currentTimeMillis()
- val health = HttpResponse(status = StatusCodes.OK, entity = HttpEntity(ContentTypes.`application/json`, serverStatus))
+ def uptime = System.currentTimeMillis() - startAt
+
+ def serverHealth = s"""{ "port": ${port}, "interface": "${interface}", "started_at": ${Instant.ofEpochMilli(startAt)}, "uptime": "${uptime} millis" """
+
+ def health = HttpResponse(status = StatusCodes.OK, entity = HttpEntity(ContentTypes.`application/json`, serverHealth))
// Allows you to determine routes to expose according to external settings.
lazy val routes: Route = concat(