pinba

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

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

Go to latest
Published: Dec 27, 2017 License: MIT Imports: 7 Imported by: 3

README

Pinba

Package pinba provides convenient wrapper to work with Pinba (https://github.com/tony2001/pinba_extension) protobuf messages

Documentation

Overview

Package pinba provides convenient wrapper to work with pinba (https://github.com/tony2001/pinba_extension) protobuf messages

Index

Constants

View Source
const MaxTags = 16

MaxTags is how many tags we can have. OpenTSDB limits it to 8, so let it be 16 :)

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	proto.Request // protobuf Request

	Timers Timers
	Tags   Tags
}

Request wraps "raw" protobuf request and add convinient structs for Tags and Timers

func NewRequest

func NewRequest(data []byte) (*Request, error)

NewRequest unmarshal protobuf packet from given data, and convert raw tags and timers data to Tags and Timers structs

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is pair of key and value

type Tags

type Tags []Tag

Tags is a list of tags

func (Tags) Filter

func (tags Tags) Filter(filter []string) Tags

Filter will filter (surprise :) tags by given keys, and return new Tags slice Code a bit strange, but that way we don't need to use append and it's almost twice as fast (480ns/op vs. 800ns/op)

func (Tags) Get

func (tags Tags) Get(key string) (string, error)

Get will return value of tag by given key or error if no such tag exists

func (Tags) GetMap

func (tags Tags) GetMap() map[string]string

GetMap will tags as map

func (Tags) Len

func (tags Tags) Len() int

func (Tags) Less

func (tags Tags) Less(i, j int) bool

func (Tags) String

func (tags Tags) String() string

String will return tags as string such as "key=value key2=value2" Tags will be sorted by Key's

func (Tags) Stringf

func (tags Tags) Stringf(format string) string

Stringf will return tags as formated string, with given format {xxx} will be replaced with value of tag xxx

func (Tags) Swap

func (tags Tags) Swap(i, j int)

type Timer

type Timer struct {
	Tags     Tags
	HitCount int32
	Value    float32
	RuUtime  float32
	RuStime  float32
}

type Timers

type Timers []Timer

func (Timers) String

func (t Timers) String() string

Directories

Path Synopsis
Package Pinba is a generated protocol buffer package.
Package Pinba is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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