otelpubsub

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package otelpubsub provides an OpenTelemetry and Prometheus observer for the pubsub package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewObserver

func NewObserver(opts ...ObserverOpt) pubsub.Observer

NewObserver creates a new pubsub.Observer that exports metrics to OpenTelemetry and Prometheus, and starts traces for message publications. It accepts variadic options for configuration.

By default, Prometheus metrics are registered with the global registry (prometheus.DefaultRegisterer). If multiple observers are created with the default registry, they will share the same Prometheus metrics. To use multiple independent observers with separate metrics in the same process, provide separate registries using the WithPrometheusRegistry option.

Types

type ObserverOpt

type ObserverOpt func(*observerConfig)

ObserverOpt is a functional option for configuring an Observer.

func WithPrometheusRegistry

func WithPrometheusRegistry(registry prometheus.Registerer) ObserverOpt

WithPrometheusRegistry sets a custom Prometheus registry for the Observer. If not provided, the default global registry (prometheus.DefaultRegisterer) will be used. Use this option when you need multiple independent observer instances with separate metrics.

func WithServiceName

func WithServiceName(name string) ObserverOpt

WithServiceName sets the service name for the Observer.

Jump to

Keyboard shortcuts

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