cmetrics

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 5

README

CMetrics Golang

CI

Golang bindings for cmetrics library.

Installation

Requirement: Install the debian/rpm dependencies from here then import this into your go path:

go get -u github.com/calyptia/cmetrics-go

Usage

Please check the test files for examples on how to use the library. Test examples

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/calyptia/cmetrics-go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FreeCStringArray

func FreeCStringArray(ptr **C.char, length int)

FreeCStringArray frees memory allocated by GoStringArrayToCptr. Must be called after the C function that uses the array returns.

func GoStringArrayToCptr

func GoStringArrayToCptr(arr []string) **C.char

func NewRawCMTPointer

func NewRawCMTPointer() (unsafe.Pointer, error)

Types

type Context

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

func NewContext

func NewContext() (*Context, error)

func NewContextFromCMTPointer

func NewContextFromCMTPointer(cmt unsafe.Pointer) (*Context, error)

func NewContextFromMsgPack

func NewContextFromMsgPack(msgPackBuffer []byte, offset int64) (*Context, error)

func NewContextSetFromMsgPack

func NewContextSetFromMsgPack(msgPackBuffer []byte, offset int) ([]*Context, error)

func (*Context) CounterCreate

func (ctx *Context) CounterCreate(namespace, subsystem, name, help string, labelKeys []string) (*Counter, error)

func (*Context) Destroy

func (ctx *Context) Destroy()

func (*Context) Encode

func (ctx *Context) Encode(t EncoderType) (interface{}, error)

func (*Context) EncodeInflux

func (ctx *Context) EncodeInflux() (string, error)

func (*Context) EncodeMsgPack

func (ctx *Context) EncodeMsgPack() ([]byte, error)

func (*Context) EncodePrometheus

func (ctx *Context) EncodePrometheus() (string, error)

func (*Context) EncodeText

func (ctx *Context) EncodeText() (string, error)

func (*Context) GaugeCreate

func (ctx *Context) GaugeCreate(namespace, subsystem, name, help string, labelKeys []string) (*Gauge, error)

func (*Context) LabelAdd

func (ctx *Context) LabelAdd(key, val string) error

type Counter

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

func (*Counter) Add

func (g *Counter) Add(ts time.Time, value float64, labels []string) error

func (*Counter) GetVal

func (g *Counter) GetVal(labels []string) (float64, error)

func (*Counter) Inc

func (g *Counter) Inc(ts time.Time, labels []string) error

func (*Counter) Set

func (g *Counter) Set(ts time.Time, value float64, labels []string) error

type EncoderType

type EncoderType string
const (
	MsgPackEncoder    EncoderType = "MsgPackEncoder"
	PrometheusEncoder EncoderType = "PrometheusEncoder"
	InfluxEncoder     EncoderType = "InfluxEncoder"
	TextEncoder       EncoderType = "TextEncoder"
)

type Gauge

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

func (*Gauge) Add

func (g *Gauge) Add(ts time.Time, value float64, labels []string) error

func (*Gauge) Dec

func (g *Gauge) Dec(ts time.Time, labels []string) error

func (*Gauge) GetVal

func (g *Gauge) GetVal(labels []string) (float64, error)

func (*Gauge) Inc

func (g *Gauge) Inc(ts time.Time, labels []string) error

func (*Gauge) Set

func (g *Gauge) Set(ts time.Time, value float64, labels []string) error

func (*Gauge) Sub

func (g *Gauge) Sub(ts time.Time, value float64, labels []string) error

Jump to

Keyboard shortcuts

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