Initial ORION Telemetry service
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/lyra/orion-telemetry/internal/version"
|
||||
)
|
||||
|
||||
func Health(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"service": version.Service,
|
||||
"status": "healthy",
|
||||
})
|
||||
}
|
||||
|
||||
func Version(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"service": version.Service,
|
||||
"version": version.Version,
|
||||
"commit": version.Commit,
|
||||
"buildTime": version.BuildTime,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
func NewRouter() *gin.Engine {
|
||||
r := gin.Default()
|
||||
|
||||
r.GET("/health", Health)
|
||||
r.GET("/version", Version)
|
||||
r.GET("/metrics", gin.WrapH(promhttp.Handler()))
|
||||
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user