goniplus

package module
v0.0.0-...-2499f37 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2016 License: MIT Imports: 17 Imported by: 0

README

goniplus

Application metric collector for Goni

Go Report Card Build Status godoc codecov

Install

import "github.com/monitflux/goniplus"
Get API Key
  • If you use hosted service,
    • Signup and create new project.
  • If you use self hosted(private) service,
    • Go to hosted website dashboard, signup, and create new project.
    • For more information, please check Goni wiki.

Metrics

Goni+ can collect

  • CPU Usage (linux only)
  • Expvar Metrics
  • HTTP Metrics
  • Runtime Metrics

Some metrics can be collected manually.

  • Breadcrumb (HTTP request track)
  • Error

Middleware Support

Goni is specialized to web application monitoring, so Goni+ supports multiple web frameworks. Supported web frameworks are listed below.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExcludeMemstatKey = "BySize PauseEnd PauseNs"

ExcludeMemstatKey is a string not to be included in expvar memstats metric map. Key is separated by space.

Functions

func CreateRequestID

func CreateRequestID(m, p string) string

CreateRequestID returns request id (string) for request tracking

func Error

func Error(tag, err string)

Error add passed tag, error (explanation) to error map.

func GetApplicationMetric

func GetApplicationMetric() *pb.ApplicationMetric

GetApplicationMetric returns ApplicationMetric.

func GetCPUUsage

func GetCPUUsage() (float64, error)

GetCPUUsage returns CPU usage(float64). If system doesn't support /proc/stat or failed to parse cpu data will return 0.0 with Error.

func GetErrorMetric

func GetErrorMetric() []*pb.ApplicationMetric_Error

GetErrorMetric returns error map, and initialize error map.

func GetExpvar

func GetExpvar() map[string]string

GetExpvar returns expvar metric map. For memstats, key specified in ExcludeMemstatKey will be excluded.

func GetResource

func GetResource() *pb.SystemMetric_Resource

GetResource returns resource metric

func GetRuntime

func GetRuntime() *pb.SystemMetric_Runtime

GetRuntime returns runtime metric map.

func GetSystemMetric

func GetSystemMetric() *pb.SystemMetric

GetSystemMetric returns SystemMetric.

func GetTransactionMetric

GetTransactionMetric returns http metric map.

func GetUnixTimestamp

func GetUnixTimestamp() string

GetUnixTimestamp returns UnixTimestamp in string.

func LeaveBreadcrumb

func LeaveBreadcrumb(r *http.Request, tag string)

LeaveBreadcrumb add specified tag to array

func Middleware

func Middleware(h http.HandlerFunc) http.HandlerFunc

Middleware returns net/http middleware

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for server communication

func InitSDK

func InitSDK(apikey string, interval int) *Client

InitSDK initialize and returns goniplus sdk client

func (*Client) SetMetricURL

func (c *Client) SetMetricURL(url string)

SetMetricURL sets metric url to provided url

type Request

type Request struct {
	// contains filtered or unexported fields
}

Request is a type that wraps request information

func StartRequestTrack

func StartRequestTrack(r *http.Request) *Request

StartRequestTrack starts request tracking

func (*Request) FinishRequestTrack

func (r *Request) FinishRequestTrack(status int, panic bool)

FinishRequestTrack finishes request tracking

type RequestData

type RequestData struct {
	Breadcrumb     []string `json:"crumb,omitempty"`
	BreadcrumbTime []int64  `json:"crumbT,omitempty"`
	Panic          bool     `json:"panic,omitempty"`
	ResponseTime   int64    `json:"res"`
	Timestamp      string   `json:"time"`
}

RequestData is a type for keeping request tracking data

type ResponseWriterWrapper

type ResponseWriterWrapper struct {
	// contains filtered or unexported fields
}

ResponseWriterWrapper wrap ResponseWriter for net/http middleware support

func (*ResponseWriterWrapper) Header

func (rww *ResponseWriterWrapper) Header() http.Header

Header is implementaion of net/http ResponseWriter Header()

func (*ResponseWriterWrapper) Status

func (rww *ResponseWriterWrapper) Status() int

Status returns the HTTP status code

func (*ResponseWriterWrapper) Write

func (rww *ResponseWriterWrapper) Write(b []byte) (int, error)

Write is implementaion of snet/http ResponseWriter Write()

func (*ResponseWriterWrapper) WriteHeader

func (rww *ResponseWriterWrapper) WriteHeader(s int)

WriteHeader sets the header with status

Jump to

Keyboard shortcuts

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