observe

package
v0.0.0-...-239384d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause, CC-BY-4.0 Imports: 15 Imported by: 0

Documentation

Overview

Package observe provides metric and tracing support for Go servers. It uses OpenTelemetry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, name string) (context.Context, trace.Span)

Types

type Observer

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

An Observer handles tracing, logging 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) 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