telemetry

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 10 Imported by: 0

README

Go PkgGoDev GoDoc Go Report Card Codacy Badge Version Badge

telemetry

Documentation

Overview

Package telemetry is a package that provides a slog.Handler that supports telemetry messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64Counter

func Float64Counter(ctx context.Context, name string, value float64, attrs ...slog.Attr)

Float64Counter logs a float64 counter metric.

func Float64Histogram

func Float64Histogram(ctx context.Context, name string, value float64, attrs ...slog.Attr)

Float64Histogram logs a float64 histogram metric.

func Int64Counter

func Int64Counter(ctx context.Context, name string, value int64, attrs ...slog.Attr)

Int64Counter logs an int64 counter metric.

func Int64Histogram

func Int64Histogram(ctx context.Context, name string, value int64, attrs ...slog.Attr)

Int64Histogram logs an int64 histogram metric.

func SpanEnd

func SpanEnd(ctx context.Context, name string, attrs ...slog.Attr)

SpanEnd ends the span in the context.

func SpanEvent

func SpanEvent(ctx context.Context, name string, attrs ...slog.Attr)

SpanEvent adds an event to the span in the context.

func SpanStart

func SpanStart(ctx context.Context, name string, attrs ...slog.Attr) context.Context

SpanStart starts a new span and returns a new context with the span attached.

Types

type Handler

type Handler interface {
	slog.Handler
	WithFloat64Counter(name string, x metric.Float64Counter)
	WithInt64Counter(name string, x metric.Int64Counter)
	WithFloat64Histogram(name string, x metric.Float64Histogram)
	WithInt64Histogram(name string, x metric.Int64Histogram)
}

Handler is a handler that supports telemetry messages.

func New

func New(
	logHandler slog.Handler,
	meter metric.Meter,
	tracer trace.Tracer,
	attributes ...attribute.KeyValue,
) Handler

New returns a new handler that wraps the provided handler and handles telemetry messages.

type Value

type Value interface{ int64 | float64 }

Value is a type that can be used as a value for a metric.

Jump to

Keyboard shortcuts

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