tracing

package
v5.0.0-...-14e0c58 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tracing provides an abstraction of OpenTelemetry SpanExporter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitExporters

func InitExporters(ctx context.Context, svc otel2.Service, cfg Config) error

InitExporters creates the global trace.Provider and refresh dynamic Exporters. Sample URLs: "stdout://", "jaeger://localhost:14268/api/traces",

func OpenTracing

func OpenTracing(ctx context.Context, urlstr string) (trace.SpanExporter, error)

OpenTracing opens the Registry identified by the URL given. See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.

func StartLocalSpan

func StartLocalSpan(ctx context.Context, name string, callerSkip ...int) (context.Context, trace2.Span)

StartLocalSpan starts creates a new span and start recording. Do NOT forget to defer its End() method!

Types

type Config

type Config struct {
	Outputs           []string          `json:"outputs" yaml:"outputs"`
	ServiceName       string            `json:"service" yaml:"service"`
	ServiceAttributes map[string]string `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

type URLMux

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

URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.

The zero value is a multiplexer with no registered schemes.

func DefaultURLMux

func DefaultURLMux() *URLMux

DefaultURLMux returns the URLMux used by OpenTopic and OpenSubscription.

Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.

func (*URLMux) OpenServer

func (mux *URLMux) OpenServer(ctx context.Context, urlstr string) (trace.SpanExporter, error)

OpenServer calls OpenTopicURL with the URL parsed from urlstr. OpenTopic is safe to call from multiple goroutines.

func (*URLMux) Register

func (mux *URLMux) Register(scheme string, opener URLOpener)

Register registers the opener with the given scheme. If an opener already exists for the scheme, Register panics.

type URLOpener

type URLOpener interface {
	OpenURL(ctx context.Context, u *url.URL) (trace.SpanExporter, error)
}

URLOpener represents types than can open Registries based on a URL. The opener must not modify the URL argument. OpenURL must be safe to call from multiple goroutines.

This interface is generally implemented by types in driver packages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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