info

package
v0.0.0-...-deaab2c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2018 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(version, repo, commit, build string) router.Handle

Handler provides JSON API response giving service information

Example

ExampleHandler is a usage example for info.Handler

package main

import (
	"github.com/skillcoder/go-common-handlers/info"
	"github.com/takama/router"
)

func main() {
	r := router.New()

	version := "1.0.0"
	repo := "go-common-handlers"
	commit := "356a192b7913b04c54574d18c28d46e6395428ab"

	r.GET("/info", info.Handler(version, repo, commit))
	r.Listen(":3000")
}
Output:

Types

type RuntimeInfo

type RuntimeInfo struct {
	Compiler   string `json:"compilier"`
	CPU        int    `json:"cpu"`
	Memory     string `json:"memory"`
	Goroutines int    `json:"goroutines"`
	Uptime     string `json:"uptime"`
}

RuntimeInfo defines runtime part of service information

type ServiceInfo

type ServiceInfo struct {
	Host    string       `json:"host"`
	Version string       `json:"version"`
	Repo    string       `json:"repo"`
	Commit  string       `json:"commit"`
	Build   string       `json:"build"`
	Runtime *RuntimeInfo `json:"runtime"`
}

ServiceInfo defines HTTP API response giving service information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL