metrics

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceNameKey       = attribute.Key("service")
	ServiceInstanceIDKey = attribute.Key("service_instance_id")
)
View Source
const EnvPrefix = "OTEL"

Variables

View Source
var ErrWrongCountOfArguments = errors.New("error wrong count of arguments")

Functions

func PrepareAttributes

func PrepareAttributes(keyValues ...string) ([]attribute.KeyValue, error)

Types

type Chart

type Chart interface {
	Execute(ctx context.Context, value int64, subject string, keyValues ...string) error
}

type Config

type Config struct {
	Prefix      string `env:"_PREFIX" envDefault:"fl"`
	Namespace   string `env:"_NAMESPACE" envDefault:"none"`
	ServiceName string `env:"_SERVICE_NAME" envDefault:"core"`
	Version     string `env:"_SERVICE_VERSION" envDefault:"v1.0.0"`
}

func GetConfigFromEnv

func GetConfigFromEnv() (*Config, error)

func (*Config) GetOptions

func (c *Config) GetOptions() []metric.MeterOption

type HistogramChart

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

func NewHistogramChart

func NewHistogramChart(histogram metric.Int64Histogram) *HistogramChart

func (*HistogramChart) Execute

func (c *HistogramChart) Execute(ctx context.Context, value int64, subject string, keyValues ...string) error

type Metric

type Metric interface {
	Get(chartName string) Chart
}

type OTLPMetric

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

func Default

func Default(ctx context.Context) (*OTLPMetric, error)

func NewOTLPMetric

func NewOTLPMetric(
	ctx context.Context,
	meterProvider *sdkmetric.MeterProvider,
	meter metric.Meter,
	prefix string,
) *OTLPMetric

func (*OTLPMetric) GetMetric

func (o *OTLPMetric) GetMetric() metric.Meter

func (*OTLPMetric) Histogram

func (o *OTLPMetric) Histogram(chartName string) (Chart, error)

func (*OTLPMetric) Shutdown

func (o *OTLPMetric) Shutdown()

type Wrapper

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

func NewWrapper

func NewWrapper(met *OTLPMetric, histogram string) Wrapper

func (Wrapper) Execute

func (w Wrapper) Execute(ctx context.Context, value int64, subject string, keyValues ...string)

Jump to

Keyboard shortcuts

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