metric

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

This package allows you to init and enable metric in your app

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMeterProvider

func GetMeterProvider() metric.MeterProvider

func InitProvider

func InitProvider(
	ctx context.Context,
	serviceName string,
	options ...ProviderOptionFunc,
) (func() error, error)

func Meter

func Meter(name string, opts ...metric.MeterOption) metric.Meter

func SetMeterProvider

func SetMeterProvider(mp metric.MeterProvider)

func Start

func Start(
	ctx context.Context,
	appName string,
	host string,
	port int,
	apiKey string,
	isSecure bool,
) (func(context.Context) error, error)

Types

type ProviderOptionFunc

type ProviderOptionFunc func(*provider) error

ProviderOptionFunc is the option function for provider

func WithGRPCMetricExporter

func WithGRPCMetricExporter(ctx context.Context, options ...otlpmetricgrpc.Option) ProviderOptionFunc

WithGRPCMetricExporter allows you to send your metrics to the collector target collectorTarget is the address of the collector, e.g. "127.0.0.1:4317"

func WithWriterMetricExporter

func WithWriterMetricExporter(w io.Writer) ProviderOptionFunc

WithWriterMetricExporter allows you to push all metrics to an io.Writer you can use io.Discard if you don't want to be bothered by these

Jump to

Keyboard shortcuts

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