observability

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package observability provides functionality for initializing OpenTelemetry's traces and metrics. It includes methods for setting up and shutting down the observability components.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SucceededAttribute is the attribute key-value pair for a succeeded operation.
	SucceededAttribute = attribute.String(statusAttribute, "succeeded")
	// FailedAttribute is the attribute key-value pair for a failed operation.
	FailedAttribute = attribute.String(statusAttribute, "failed")
)

Functions

func ClientAttribute

func ClientAttribute(name string) attribute.KeyValue

ClientAttribute returns the attribute key-value pair for a client.

func ComponentAttribute

func ComponentAttribute(name string) attribute.KeyValue

ComponentAttribute returns the attribute key-value pair for a component.

func StatusAttribute

func StatusAttribute(err error) attribute.KeyValue

StatusAttribute returns the attribute key-value pair for the status of an operation.

Types

type Config

type Config struct {
	Name      string
	Version   string
	LogConfig log.Config
}

Config represents the configuration for setting up traces, metrics and logs.

type Provider

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

Provider represents the observability provider that includes the metric and trace providers.

func Setup

func Setup(ctx context.Context, cfg Config) (*Provider, error)

Setup initializes OpenTelemetry's traces and metrics. It creates a resource with the given name and version, sets up the metric and trace providers, and returns a Provider containing the initialized providers.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown flushes and shuts down the metrics and traces. It forces a flush of metrics and traces, logs any errors encountered during flushing, and shuts down the metric and trace providers.

Directories

Path Synopsis
Package log provides logging abstractions.
Package log provides logging abstractions.

Jump to

Keyboard shortcuts

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