opentelemetry

package module
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package opentelemetry is the data access object

Package opentelemetry is the data access object

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled         bool
	LogHandler      map[string]struct{}
	LogMethod       map[string]struct{}
	Application     string
	Namespace       string
	SubSystem       string
	SizeBuckets     []float64
	DurationBuckets []float64
	Objectives      map[float64]float64
	DefaultCollect  bool
	MetricLabels    map[metrics.MetricType][]string
	UseSecure       bool
	BasicUserName   string
	BasicPassword   string
	HandlerFunc     http.HandlerFunc
}

type OpenTelemetry

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

OpenTelemetry is a OpenTelemetry wrapper counter only statistics count value in prometheus requestDurationSeconds statistics bucket,count,sum in prometheus summaryLatency statistics count,sum in prometheus

func New

func New(ctx context.Context, configs ...*Config) (*OpenTelemetry, error)

New creates a new OpenTelemetry instance with the given configuration.

func (*OpenTelemetry) Context

func (t *OpenTelemetry) Context() context.Context

func (*OpenTelemetry) CounterEvent

func (t *OpenTelemetry) CounterEvent(module, event string)

func (*OpenTelemetry) CounterException

func (t *OpenTelemetry) CounterException(module, errors string)

func (*OpenTelemetry) CounterRecvBytes

func (t *OpenTelemetry) CounterRecvBytes(module, handler, method, code string, length int64)

CounterRecvBytes is a Go function that logs received bytes.

It takes the following parameters: module (string), handler (string), method (string), code (string), length (float64). It does not return anything.

func (*OpenTelemetry) CounterSendBytes

func (t *OpenTelemetry) CounterSendBytes(module, handler, method, code string, length int64)

CounterSendBytes logs the byte count for a specific module, Handler, method, and code.

Parameters: module string, handler string, method string, code string, length float64. Return type: none.

func (*OpenTelemetry) CounterSiteEvent

func (t *OpenTelemetry) CounterSiteEvent(module, event, site string)

func (*OpenTelemetry) Disable

func (t *OpenTelemetry) Disable()

func (*OpenTelemetry) Enabled

func (t *OpenTelemetry) Enabled() bool

func (*OpenTelemetry) Log

func (t *OpenTelemetry) Log(ctx context.Context, handler string, method string, code int, sendBytes, recvBytes int64, latency float64)

Log logs the Handler request and its details.

Parameters: code string, method string, handler string, sendBytes float64, recvBytes float64, latency float64.

func (*OpenTelemetry) Observe

func (t *OpenTelemetry) Observe(ctx context.Context, data metrics.MetricData)

Observe uses the OpenTelemetry metric collector to observe and record metrics.

This method takes a reporter parameter of type metrics.Reporter interface, which is used to report metric data. Through this method, a OpenTelemetry instance can receive and process metric information from various sources, enabling real-time monitoring and data collection of system or application performance.

The method does not return any value; its primary purpose is to update and maintain the internal metric collectors of OpenTelemetry. By calling this method, one can ensure that relevant metric data is correctly collected and stored for subsequent analysis and querying.

func (*OpenTelemetry) RequestTotal

func (t *OpenTelemetry) RequestTotal(module, handler, method, code string)

RequestTotal logs the request with the given module, handler, method, and code.

Parameters: module string, handler string, method string, code string. Return type: none.

func (*OpenTelemetry) RequestsDurationSeconds

func (t *OpenTelemetry) RequestsDurationSeconds(module string, handler string, method string, latency float64)

RequestsDurationSeconds logs the latency of a requestDurationSeconds module, Handler, and method.

module: the name of the module. handler: the name of the Handler handler. method: the name of the method. latency: the latency of the Handler call.

func (*OpenTelemetry) RequestsInFlight

func (t *OpenTelemetry) RequestsInFlight(module, state string, value float64)

RequestsInFlight logs a state in a module.

module: the name of the module. state: the name of the state. value: the value of the state.

Jump to

Keyboard shortcuts

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