pgotel

package module
v10.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: BSD-2-Clause Imports: 10 Imported by: 6

README

OpenTelemetry instrumentation for go-pg

Installation

go get github.com/go-pg/pg/extra/pgotel/v10

Usage

Tracing is enabled by adding a query hook:

import (
	"github.com/go-pg/pg/v10"
	"github.com/go-pg/pg/extra/pgotel/v10"
)

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