observe

package
v0.0.0-...-25a572b Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package observe provides metric and tracing support for Go servers. It uses OpenTelemetry and the golang.org/x/exp/events package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observer

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

An Observer handles tracing and metrics exporting.

func NewObserver

func NewObserver(ctx context.Context, projectID, serverName string) (_ *Observer, err error)

NewObserver creates an Observer. The context is used to flush traces in AfterRequest, so it should be longer-lived than any request context. (We don't want to use the request context because we still want traces even if it is canceled or times out.)

func (*Observer) Event

func (o *Observer) Event(ctx context.Context, ev *event.Event) context.Context

Event implements event.Handler.

func (*Observer) Observe

func (o *Observer) Observe(h http.Handler) http.Handler

Observe adds metrics and tracing to an http.Handler.

Jump to

Keyboard shortcuts

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