pgotel

package module
v12.0.0-...-4590b8f Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: BSD-2-Clause Imports: 9 Imported by: 0

README

OpenTelemetry instrumentation for go-pg

Installation

go get github.com/yz89122/pgorm/extra/pgotel/v12

Usage

Tracing is enabled by adding a query hook:

import (
	"github.com/yz89122/pgorm/v12"
	"github.com/yz89122/pgorm/extra/pgotel/v12"
)

db := pg.Connect(&pg.Options{...})

db.AddQueryHook(pgotel.NewTracingHook())

See documentation for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TracingHook

type TracingHook struct{}

TracingHook is a pg.QueryHook that adds OpenTelemetry instrumentation.

func NewTracingHook

func NewTracingHook() *TracingHook

func (*TracingHook) AfterQuery

func (h *TracingHook) AfterQuery(ctx context.Context, evt *pg.QueryEvent) error

func (*TracingHook) BeforeQuery

func (h *TracingHook) BeforeQuery(ctx context.Context, _ *pg.QueryEvent) (context.Context, error)

Jump to

Keyboard shortcuts

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