cmetrics

package module
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 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