pprofserver

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

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 28 Imported by: 0

README

pprof-server CircleCI

Web server exposing performance profiles of Go services.

Building

govendor sync
go build ./cmd/pprof-server

Running

./pprof-server -registry consul://localhost:8500
docker run -it --rm -p 6061:6061 segment/pprof-server -registry consul://172.17.0.1:8500

Screenshot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsulRegistry

type ConsulRegistry struct{}

func (*ConsulRegistry) ListServices

func (r *ConsulRegistry) ListServices(ctx context.Context) ([]string, error)

func (*ConsulRegistry) LookupService

func (r *ConsulRegistry) LookupService(ctx context.Context, name string) (Service, error)

func (*ConsulRegistry) String

func (r *ConsulRegistry) String() string

type Handler

type Handler struct {
	Prefix   string
	Registry Registry
	Client   *http.Client
}

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(res http.ResponseWriter, req *http.Request)

type Host

type Host struct {
	Addr net.Addr
	Tags []string
}

type KubernetesRegistry

type KubernetesRegistry struct {
	Namespace string
	// contains filtered or unexported fields
}

KubernetesRegistry is a registry which discovers PODs running on a Kubernetes cluster.

TODO: give the ability to configure multiple Kubernetes clusters.

func NewKubernetesRegistry

func NewKubernetesRegistry(client *kubernetes.Clientset) *KubernetesRegistry

func (*KubernetesRegistry) Init

func (k *KubernetesRegistry) Init(ctx context.Context)

Init initialize the watcher and store configuration for the registry.

func (*KubernetesRegistry) ListServices

func (k *KubernetesRegistry) ListServices(ctx context.Context) ([]string, error)

func (*KubernetesRegistry) LookupService

func (k *KubernetesRegistry) LookupService(ctx context.Context, name string) (Service, error)

LookupService implements the Registry interface. The returned Service will contain one Host entry per POD IP+container exposed port.

func (*KubernetesRegistry) String

func (k *KubernetesRegistry) String() string

Name implements the Registry interface.

type Registry

type Registry interface {
	ListServices(ctx context.Context) ([]string, error)
	LookupService(ctx context.Context, name string) (Service, error)
	String() string
}

type Service

type Service struct {
	Name  string
	Hosts []Host
}

func (Service) ListServices

func (s Service) ListServices(ctx context.Context) ([]string, error)

func (Service) LookupService

func (s Service) LookupService(ctx context.Context, name string) (Service, error)

func (Service) String

func (s Service) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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