debugcharts

package module
v0.0.0-...-f7ed102 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: MIT Imports: 12 Imported by: 0

README

debugcharts Build Status

Go memory debug charts.

This package uses Plotly chart library. It is open source and free for use.

Installation

go get -v -u github.com/mkevac/debugcharts

Usage

Just install package and start http server. There is an example program here.

Then go to http://localhost:8080/debug/charts. You should see something like this:

Data is updated every second. We keep data for last day.

User https://github.com/dgryski/ proposed interesing way for turning debugcharts on/off for your project:

You can add tagged file like this in your code

// +build debugcharts

package main

import _ "github.com/mkevac/debugcharts"

If you want to use debugcharts, then build your project with -tags debugcharts

Documentation

Overview

Simple live charts for memory consumption and GC pauses.

To use debugcharts, link this package into your program:

import _ "github.com/mkevac/debugcharts"

If your application is not already running an http DebugChartServer, you need to start one. Add "net/http" and "log" to your imports and the following code to your main function:

go func() {
	log.Println(http.ListenAndServe("localhost:6060", nil))
}()

Then go look at charts:

http://localhost:6060/debug/charts

Index

Constants

View Source
const (
	DefaultDebugChartsPattern = "/debug/charts/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUPair

type CPUPair struct {
	Ts   uint64
	User float64
	Sys  float64
}

type DataStorage

type DataStorage struct {
	HeapBytesAllocated []SimplePair
	GcPauses           []SimplePair
	CPUUsage           []CPUPair
	Pprof              []PprofPair
}

type DebugChartServer

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

func NewDebugChartServer

func NewDebugChartServer(pattern string, log Logger, interval time.Duration) *DebugChartServer

func NewDebugChartService

func NewDebugChartService(mux *http.ServeMux, pattern string, log Logger, interval time.Duration) *DebugChartServer

NewDebugChartService binds to existent mux with the given pattern

func (*DebugChartServer) Shutdown

func (p *DebugChartServer) Shutdown() error

type Logger

type Logger interface {
	Info(...interface{})
	Infof(string, ...interface{})
	Critical(...interface{})
	Criticalf(string, ...interface{})
}

type PprofPair

type PprofPair struct {
	Ts           uint64
	Block        int
	Goroutine    int
	Heap         int
	Mutex        int
	Threadcreate int
}

type SimpleLogger

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

func (SimpleLogger) Critical

func (s SimpleLogger) Critical(v ...interface{})

func (SimpleLogger) Criticalf

func (s SimpleLogger) Criticalf(format string, v ...interface{})

func (SimpleLogger) Info

func (s SimpleLogger) Info(v ...interface{})

func (SimpleLogger) Infof

func (s SimpleLogger) Infof(format string, v ...interface{})

type SimplePair

type SimplePair struct {
	Ts    uint64
	Value uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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